error: ‘module’ object has no attribute ‘_rebuild_tensor_v2’

Posted huhuai

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了error: ‘module’ object has no attribute ‘_rebuild_tensor_v2’相关的知识,希望对你有一定的参考价值。

import torch._utils

try:

     torch._utils._rebuild_tensor_v2

except AttributeError:

     def _rebuild_tensor_v2(storage, storage_offset, size, stride, requires_grad, backward_hooks):

                 tensor = torch._utils._rebuild_tensor(storage, storage_offset, size, stride)

                 tensor.requires_grad = requires_grad

                 tensor._backward_hooks = backward_hooks

                 return tensor

   torch._utils._rebuild_tensor_v2 = _rebuild_tensor_v2

以上是关于error: ‘module’ object has no attribute ‘_rebuild_tensor_v2’的主要内容,如果未能解决你的问题,请参考以下文章

在angular中用node.js连接redis时遇到的问题——process is not defined at Object../node_modules/redis-errors/ind

vue UI报错Error: NO_MODULES at async Object.wrap progress.js等问题

在angular中用node.js连接redis时遇到的问题——process is not defined at Object../node_modules/redis-errors/ind

在angular中用node.js连接redis时遇到的问题——process is not defined at Object../node_modules/redis-errors/ind

Error: Cannot find module '@babel/runtime/core-js/object/keys'(npm start报错)

CentOS 安装paramiko 运行报错 'module' object has no attribute 'GSSException'