自学内容网 自学内容网

Pytorch常见坑(不断更新)

一、基本错误

1、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.

原因:由于transpose()、permute()或view()等操作导致tensor内存不连续

解决办法:在这些操作后面添加.contiguous()即可


原文地址:https://blog.csdn.net/qq_34950042/article/details/142724291

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!