错误提示信息:
If your intent is to change the metadata of a Tensor (such as sizes / strides / storage / storage_offset)
without autograd tracking the change, remove the .data / .detach() call and wrap the change in a `with torch.no_grad():` block.
For example, change:
x.data.set_(y)
to:
with torch.no_grad():
x.set_(y)
出错的代码:feature.data.t_(), target.data.sub_(1)
按照提示修改
with torch.no_grad():
feature.t_(), target.sub_(1)
就可以啦o(* ̄▽ ̄*)ブ