我正在使用PyTorch训练一个网络。我正在浏览autograd文档,其中提到,对于每个张量,autograd都会实现一个计数器来跟踪任何张量的“版本”。如何得到图中任何张量的计数器
我需要它的原因。
我遇到了自动签名错误
[torch.cuda.FloatTensor [x, y, z]], which is output 0 of torch::autograd::CopySlices, is at version 7; expected version 6 instead. Hint: the backtrace further above shows the operation that failed to compute its gradient. The variable in question was changed in there or anywhere later. Good luck!
这对我来说并不新鲜,我以前也成功地处理过。这一次我不明白为什么张量会在第7版而不是第6版。为了回答这个问题,我想知道运行中任何给定点的版本
谢谢
它可以通过命令
tensor_name._version
获得作为如何使用它的示例,提供了以下MSE
相关问题 更多 >
编程相关推荐