pytorch报错

Variable._execution_engine.run_backward(
RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.FloatTensor [32, 50, 180]], which is output 0 of AddBackward0, is at version 2; expected version 1 instead. Hint: enable anomaly detection to find the operation that failed to compute its gradient, with torch.autograd.set_detect_anomaly(True).

记录一下这个错误,查了无数博客,发现最后问题就只是一个q*=修改为q = q self.scaling就解决了

你可能感兴趣的:(pytorch,深度学习,人工智能)