这个问题是由于小虎在用DP的时候出现的,解决方法是在特别的变量后面加上.contiguous()
。
环境
python 3.10 + Pytorch2.0
问题原文
/home/xiaohu/anaconda3/envs/smor/lib/python3.10/site-packages/torch/autograd/__init__.py:251: UserWarning: Grad strides do not match bucket view strides. This may indicate grad was not created according to the gradient layout contract, or that the param's strides changed since DDP was constructed. This is not an error, but may impair performance.
grad.sizes() = [3, 24, 1, 1], strides() = [24, 1