会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
半夜打老虎
博客园
首页
新随笔
联系
订阅
管理
2021年10月21日
Pytorch训练模型常用操作
摘要: One-hot编码 将标签转换为one-hot编码形式 def to_categorical(y, num_classes): """ 1-hot encodes a tensor """ new_y = torch.eye(num_classes)[y.cpu().data.numpy(), ]
阅读全文
posted @ 2021-10-21 10:05 半夜打老虎
阅读(497)
评论(0)
推荐(0)
公告