mindspore.nn.probability.bijector.Invert

class mindspore.nn.probability.bijector.Invert(bijector, name='')[source]

Invert Bijector. Compute the inverse function of the input bijector.

Parameters
  • bijector (Bijector) – Base Bijector.

  • name (str) – The name of the Bijector. Default: ‘Invert’ + bijector.name.

Supported Platforms:

Ascend GPU

Examples

>>> import mindspore
>>> import mindspore.nn as nn
>>> import mindspore.nn.probability.bijector as msb
>>> from mindspore import Tensor
>>> import mindspore.context as context
>>> context.set_context(mode=1)
>>>
>>> # To initialize an inverse Exp bijector.
>>> inv_exp = msb.Invert(msb.Exp())
>>> value = Tensor([1, 2, 3], dtype=mindspore.float32)
>>> ans1 = inv_exp.forward(value)
>>> print(ans1.shape)
(3,)
>>> ans2 = inv_exp.inverse(value)
>>> print(ans2.shape)
(3,)
>>> ans3 = inv_exp.forward_log_jacobian(value)
>>> print(ans3.shape)
(3,)
>>> ans4 = inv_exp.inverse_log_jacobian(value)
>>> print(ans4.shape)
(3,)