analogvnn.graph.AccumulateGrad#

Module Contents#

Classes#

AccumulateGrad

AccumulateGrad is a module that accumulates the gradients of the outputs of the module it is attached to.

class analogvnn.graph.AccumulateGrad.AccumulateGrad(module: Union[torch.nn.Module, Callable])[source]#

AccumulateGrad is a module that accumulates the gradients of the outputs of the module it is attached to.

It has no parameters of its own.

Variables:
  • module (nn.Module) – Module to accumulate gradients for.

  • input_output_connections (Dict[str, Dict[str, Union[None, bool, int, str, GRAPH_NODE_TYPE]]]) – input/output

  • connections.

input_output_connections: Dict[str, Dict[str, Union[None, bool, int, str, analogvnn.graph.GraphEnum.GRAPH_NODE_TYPE]]][source]#
module: Union[torch.nn.Module, Callable][source]#
grad[source]#

Alias for __call__.

__repr__()[source]#

Return a string representation of the module.

Returns:

String representation of the module.

Return type:

str

__call__(grad_outputs_args_kwargs: analogvnn.graph.ArgsKwargs.ArgsKwargs, forward_input_output_graph: Dict[analogvnn.graph.GraphEnum.GRAPH_NODE_TYPE, analogvnn.graph.ArgsKwargs.InputOutput]) analogvnn.graph.ArgsKwargs.ArgsKwargs[source]#

Calculate and Accumulate the output gradients of the module.

Parameters:
  • grad_outputs_args_kwargs (ArgsKwargs) – The output gradients from previous modules (predecessors).

  • forward_input_output_graph (Dict[GRAPH_NODE_TYPE, InputOutput]) – The input and output from forward pass.

Returns:

The output gradients.

Return type:

ArgsKwargs