摘要: 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)