PyTorch “element 0 of tensors”: why does backward fail?
Summary As of October 2026, inspect loss.requires_grad and loss.grad_fn before changing a failing backward pass. For NumPy export, use tensor.numpy(force=True) with a NumPy-supported dtype/layout, or tensor.detach().cpu().numpy() when conjugate and negative bits are clear; detaching the training loss is not the repair (checked 2026-10-28).