我得到的输出是
Original tensor is on cuda:0 and StorageView is on cuda:0 Original tensor is on cuda:1 and StorageView is on cuda:0
实际数据仍然在 cuda:0 上,对于 y0 和 cuda:1 上的数据。
cuda:0
y0
cuda:1
gr8qqesn1#
我们使用 CUDA Array Interface 将 PyTorch Tensor加载到 StorageView 对象中,但在此接口中未暴露设备索引。我们需要在 from_array 中添加一个新参数来指定 PyTorch Tensor的设备索引。
StorageView
from_array
1条答案
按热度按时间gr8qqesn1#
我们使用 CUDA Array Interface 将 PyTorch Tensor加载到
StorageView
对象中,但在此接口中未暴露设备索引。我们需要在
from_array
中添加一个新参数来指定 PyTorch Tensor的设备索引。