class_docstr: Gradient scaler for the PyTorch shim.
  
  Gradients with small magnitudes are not representable in half-precision and
  will underflow to zero. A gradient scaler counters this issue by scaling
  up the loss before backpropagation, increasing the gradients by the same
  magnitude. A large enough scale will avoid that the gradients underflow.
  The gradients are unscaled in single precision after backpropagation, to
  provide the unscaled gradients to the optimizer.
code: def _tensors_per_device(self, tensors):
      tensors_per_device = dict()
      for tensor in tensors:
          device_tensors = tensors_per_device.setdefault(
              tensor.device, []
          )
          device_tensors.append(tensor)
  
      return tensors_per_device
  
file_path: thinc/thinc/shims/pytorch_grad_scaler.py
imports: from typing import Dict, Iterable, List, Union, cast
  from ..compat import has_torch_amp, torch
  from ..util import is_torch_array
label_desc: Use image node_id 5 for calling the PyTorchGradScaler obj's underlying member method code with example usage: obj._tensors_per_device(tensors) and returns: tensors_per_device