Skip to content
Commit 16b4509f authored by brkirch's avatar brkirch
Browse files

Add numpy fix for MPS on PyTorch 1.12.1

When saving training results with torch.save(), an exception is thrown:
"RuntimeError: Can't call numpy() on Tensor that requires grad. Use tensor.detach().numpy() instead."

So for MPS, check if Tensor.requires_grad and detach() if necessary.
parent 685f9631
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment