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: “”. When name is set to “”, it is actually ‘Invert’ + bijector.name.

Supported Platforms:

Ascend GPU

Examples

>>> import numpy as np
>>> import mindspore
>>> import mindspore.nn as nn
>>> import mindspore.nn.probability.bijector as msb
>>> from mindspore import Tensor
>>> class Net(nn.Cell):
...     def __init__(self):
...         super(Net, self).__init__()
...         self.origin = msb.ScalarAffine(scale=2.0, shift=1.0)
...         self.invert = msb.Invert(self.origin)
...
...     def construct(self, x_):
...         return self.invert.forward(x_)
>>> forward = Net()
>>> x = np.array([2.0, 3.0, 4.0, 5.0]).astype(np.float32)
>>> ans = forward(Tensor(x, dtype=mindspore.float32))
>>> print(ans.shape)
(4,)
property bijector

Return base bijector.

forward(x)[source]

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

forward_log_jacobian(x)[source]

Logarithm of the derivative of the inverse transformation.

inverse(y)[source]

Forward transformation: transform the input value to another distribution.

inverse_log_jacobian(y)[source]

Logarithm of the derivative of the forward transformation.