mindspore.nn.probability.bijector.Bijector

class mindspore.nn.probability.bijector.Bijector(is_constant_jacobian=False, is_injective=True, name=None, dtype=None, param=None)[source]

Bijecotr class.

Parameters
  • is_constant_jacobian (bool) – Whether the Bijector has constant derivative. Default: False.

  • is_injective (bool) – Whether the Bijector is a one-to-one mapping. Default: True.

  • name (str) – The name of the Bijector. Default: None.

  • dtype (mindspore.dtype) – The type of the distributions that the Bijector can operate on. Default: None.

  • param (dict) – The parameters used to initialize the Bijector. Default: None.

Supported Platforms:

Ascend GPU

Note

dtype of bijector represents the type of the distributions that the bijector could operate on. When dtype is None, there is no enforcement on the type of input value except that the input value has to be float type. During initialization, when dtype is None, there is no enforcement on the dtype of the parameters. All parameters should have the same float type, otherwise a TypeError will be raised. Specifically, the parameter type will follow the dtype of the input value, i.e. parameters of the bijector will be casted into the same type as input value when dtype is None. When dtype is specified, it is forcing the parameters and input value to be the same dtype as dtype. When the type of parameters or the type of the input value is not the same as dtype, a TypeError will be raised. Only subtype of mindspore.float_type can be used to specify bijector’s dtype.

cast_param_by_value(value, para)[source]

Cast the parameter(s) of the bijector to be the same type of input_value.

construct(name, *args, **kwargs)[source]

Override construct in Cell.

Note

Names of supported functions include: ‘forward’, ‘inverse’, ‘forward_log_jacobian’, and ‘inverse_log_jacobian’.

Parameters
  • name (str) – The name of the function.

  • *args (list) – A list of positional arguments that the function needs.

  • **kwargs (dict) – A dictionary of keyword arguments that the function needs.

forward(value, *args, **kwargs)[source]

Forward transformation: transform the input value to another distribution.

forward_log_jacobian(value, *args, **kwargs)[source]

Logarithm of the derivative of the forward transformation.

inverse(value, *args, **kwargs)[source]

Inverse transformation: transform the input value back to the original distribution.

inverse_log_jacobian(value, *args, **kwargs)[source]

Logarithm of the derivative of the inverse transformation.