RuntimeError:a leaf Variable that requires grad has been used in an in-place

原文链接:https://blog.csdn.net/weixin_43056332/article/details/115188116

记录一下训练yolov5碰到的问题
RuntimeError:a leaf Variable that requires grad has been used in an in-place

在报错代码前加上with torch.no_grad():
并且进行缩进!一定要缩进不然会有新的报错。
RuntimeError:a leaf Variable that requires grad has been used in an in-place_第1张图片

你可能感兴趣的:(pytorch,深度学习,机器学习)