pytorch - CUDA Illegal Memory Access on PyTorch 1.3
问题描述
@staticmethod
def backward(ctx, grad_output):
grad_label = grad_output.clone()
num_ft = grad_output.shape[0]
# grad_label.data.resize_(num_ft, 32, 41)
lin_indices_3d, lin_indices_2d = ctx.saved_variables
num_ind = lin_indices_3d.data[0]
grad_label.data.view(num_ft, -1).index_copy_(1, lin_indices_2d.data[1:1 + num_ind],
torch.index_select(grad_output.data.contiguous().view(num_ft, -1),
1, lin_indices_3d.data[1:1 + num_ind]))
# raw_input('sdflkj')
return grad_label, None, None, None
This is the code snippet I am trying to run on PyTorch. However, I strangely keep getting the error of Illegal Memory Access. When I tried to use a Debugger and try and find the culprit, I would see
As such I am not certain what is wrong here. The same code was running on PyTorch 0.4 and now I am trying to run it on PyTorch 1.3 and it does not work. The same error remains on versions 1.4 and 1.5 which are the latest versions for the framework. Any help shall be highly appreciated.
解决方案
推荐阅读
- css - 在 CSS 动画精灵表上保持响应纵横比
- powershell - 两个阵列上的 Powershell foreach
- python - 我如何使用python解决LDA中的类内散布矩阵问题
- javascript - 展平嵌套的 JavaScript 对象
- docker-registry - Sonatype Nexus3 Docker 注册表中名称无效的存储库/映像
- c# - YAML 文件未添加到构建时的 bin\debug (.NET Core)
- python - 将列表附加到 Python 中的另一个列表的问题
- azure-devops - 如何使用 azure devops 部署打包为 .nugpk 的 azure funtion 应用程序?
- c - 静态变量未初始化为给定值
- python - 如何检查模型1具有多对多关系模型2的model1.field