MCPcopy Index your code
hub / github.com/InternLM/InternLM / backward

Method backward

internlm/core/engine.py:138–145  ·  view source on GitHub ↗

Starts the backward propagation given the loss value computed by a loss function. Args: loss (torch.Tensor): The loss value computed by a loss function.

(self, loss: torch.Tensor)

Source from the content-addressed store, hash-verified

136 self._model.eval()
137
138 def backward(self, loss: torch.Tensor):
139 """
140 Starts the backward propagation given the loss value computed by a loss function.
141
142 Args:
143 loss (torch.Tensor): The loss value computed by a loss function.
144 """
145 return self.optimizer.backward(loss)
146
147 def backward_by_grad(self, tensor, grad):
148 """

Callers 3

_backward_stepMethod · 0.45
_train_one_batchMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected