BlockDiagonal#

class torchdyno.models.rnn_assembly.block_diagonal.BlockDiagonal[source]#

Bases: Module

Methods

__init__(blocks[, bias, constrained])

Initializes the block diagonal matrix.

forward(x)

Define the computation performed at every call.

Attributes

__init__(blocks, bias=False, constrained=None)[source]#

Initializes the block diagonal matrix.

Parameters:
  • blocks (List[torch.Tensor]) – list of blocks.

  • bias (bool, optional) – whether to use bias. Defaults to False.

  • constrained (Optional[Literal["fixed", "tanh", "clip", "orthogonal"]], optional) – type of constraint. Defaults to None.

forward(x)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

Parameters:

x (Tensor)

Return type:

Tensor