gluonts.mx.block.snmlp module#

class gluonts.mx.block.snmlp.SNMLPBlock(in_units: int, hidden_units: int, out_units: int, num_hidden_layers: int = 2, activation: str = 'lipswish', jacobian_method: str = 'bf', num_power_iter: int = 1, coeff: float = 0.9, flatten: bool = False)[source]#

Bases: HybridBlock

get_weights()[source]#
hybrid_forward(F, x: Union[NDArray, Symbol]) Union[NDArray, Symbol][source]#
Parameters:

x – Input Tensor

Returns:

output of SNMLPBlock

Return type:

Tensor

jacobian(x: Union[NDArray, Symbol]) Union[NDArray, Symbol][source]#
Parameters:

x – Input Tensor

Returns:

Jacobian of the SNMLPBlock evaluated at x.

Return type:

Tensor

gluonts.mx.block.snmlp.jacobian_sn_mlp_block_bf(layers: List[Tuple[HybridBlock, Union[NDArray, Symbol]]]) Union[NDArray, Symbol][source]#

Brute force computation of the jacobian of a SNMlpBlock jac is of shape (Batch dim1, …, Output dim, Input dim)

Parameters:

layers – A list of tuples where each tuple (layer, input) is associated to a composing layer of the SNMLPBlock, where layer corresponds to the associated object layer, along with its input tensor.

Returns:

Jacobian of the SNMLPBlock computed at a given input

Return type:

Tensor