MCPcopy Create free account
hub / github.com/OpenDriveLab/ReSim / grad_layer_wrt_loss

Function grad_layer_wrt_loss

sat/sgm/modules/autoencoding/magvit2_pytorch.py:149–150  ·  view source on GitHub ↗
(loss: Tensor, layer: nn.Parameter)

Source from the content-addressed store, hash-verified

147@autocast(enabled=False)
148@beartype
149def grad_layer_wrt_loss(loss: Tensor, layer: nn.Parameter):
150 return torch_grad(outputs=loss, inputs=layer, grad_outputs=torch.ones_like(loss), retain_graph=True)[0].detach()
151
152
153# helper decorators

Callers 1

forwardMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected