【发布时间】:2020-04-23 13:44:50
【问题描述】:
我有一个名为 target 的 84x84 pytorch 张量。我需要用84x84 由True 和False 组成的布尔numpy 数组来掩盖它。
当我执行target = target[mask] 时,我收到错误TypeError: can't convert np.ndarray of type numpy.bool_. The only supported types are: double, float, float16, int64, int32, and uint8.
令人惊讶的是,我只有在 GPU 上运行时才会收到此错误。在 CPU 上运行时,一切正常。我该如何解决这个问题?
【问题讨论】:
-
这里提供的答案怎么样:discuss.pytorch.org/t/…?
-
如果你能提供一个最小的例子,那就太好了。
标签: python numpy pytorch torch