【问题标题】:Torch installed but repeat_interleave not found已安装 Torch,但未找到 repeat_interleave
【发布时间】:2020-10-01 18:19:11
【问题描述】:

我已经安装了 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.__version__ 的值是多少?
  • 值为'0.4.1'
  • 可是我刚刚安装了PyTorch,为什么conda要为我安装旧版本?

标签: python pytorch


【解决方案1】:

torch.repeat_interleave 运算符是在pytorch1.1.0 版本中引入的,所以请考虑更新到1.1.0+ 版本的pytorch 以顺利使用此方法。

【讨论】:

    猜你喜欢
    • 2016-03-30
    • 2021-01-07
    • 2017-09-25
    • 2019-09-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-03-24
    • 2022-01-05
    相关资源
    最近更新 更多