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 given torch.nn.Module or another CodeBlock.

Parameters:
  • block (Callable) – torch.nn.Module or CodeBlock 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:

CodeBlock

Returns: A CodeBlock object.