• brkirch's avatar
    Add numpy fix for MPS on PyTorch 1.12.1 · 16b4509f
    brkirch authored
    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.
    16b4509f
devices.py 3.92 KB