MCPcopy Create free account
hub / github.com/ChenhongyiYang/QueryDet-PyTorch / check_backward_validity

Function check_backward_validity

utils/gradient_checkpoint.py:23–25  ·  view source on GitHub ↗
(inputs: Iterable[Any])

Source from the content-addressed store, hash-verified

21
22
23def 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,

Callers 1

forwardMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected