pytorch_pfn_extras.handler.update_parameters#
- pytorch_pfn_extras.handler.update_parameters(block, optimizers, backprop_from=None, backprop_to=None)#
Returns a
CodeBlock
that performs the forward, backward passes and applies the optimizer step for the giventorch.nn.Module
or anotherCodeBlock
.- Parameters:
block (Callable) –
torch.nn.Module
orCodeBlock
to update the parameters.optimizers (List[Optimizer]) – The list of Optimizer that will be used for parameter update.
backprop_from (Optional[str]) – Select a single output from the block execution to perform the gradient calculation.
backprop_to (Optional[Set[str]]) – Name of the values where backpropagation will be stopped.
- Return type:
Returns: A
CodeBlock
object.