已安装割炬,但未找到repeat_interleave

问题描述

我已经安装了PyTorch。 import torch运行没有错误。但是,找不到函数torch.repeat_interleave()

x = torch.tensor([1,2,3])
x.repeat_interleave(2)

给予AttributeError: 'Tensor' object has no attribute 'repeat_interleave'

为什么?

解决方法

torch.repeat_interleave版本的1.1.0中引入了pytorch运算符,因此,请考虑更新到1.1.0+的{​​{1}}版本以顺利使用此方法。