【PyTorch】解决RuntimeError: adaptive_max_pool2d_backward_cuda ...(添加注意力机制)

Error: RuntimeError: adaptive_max_pool2d_backward_cuda does not have a deterministic implementation...

查看log定位error位置:

在scaler.scale(loss).backward()前添加torch.use_deterministic_algorithms(False)

torch.use_deterministic_algorithms(False)  # added
scaler.scale(loss).backward()

你可能感兴趣的:(pytorch,深度学习,神经网络)