(inputs: Iterable[Any])
| 21 | |
| 22 | |
| 23 | def check_backward_validity(inputs: Iterable[Any]) -> None: |
| 24 | if not any(inp.requires_grad for inp in inputs if isinstance(inp, torch.Tensor)): |
| 25 | warnings.warn("None of the inputs have requires_grad=True. Gradients will be None") |
| 26 | |
| 27 | |
| 28 | # We can't know if the run_fn will internally move some args to different devices, |