Document feedback

Question document fragment

When a question document fragment contains a formula, it is displayed as a space.

Submission type
issue

It's a little complicated...

I'd like to ask someone.

Please select the submission type

Problem type
Specifications and Common Mistakes

- Specifications and Common Mistakes:

- Misspellings or punctuation mistakes,incorrect formulas, abnormal display.

- Incorrect links, empty cells, or wrong formats.

- Chinese characters in English context.

- Minor inconsistencies between the UI and descriptions.

- Low writing fluency that does not affect understanding.

- Incorrect version numbers, including software package names and version numbers on the UI.

Usability

- Usability:

- Incorrect or missing key steps.

- Missing main function descriptions, keyword explanation, necessary prerequisites, or precautions.

- Ambiguous descriptions, unclear reference, or contradictory context.

- Unclear logic, such as missing classifications, items, and steps.

Correctness

- Correctness:

- Technical principles, function descriptions, supported platforms, parameter types, or exceptions inconsistent with that of software implementation.

- Incorrect schematic or architecture diagrams.

- Incorrect commands or command parameters.

- Incorrect code.

- Commands inconsistent with the functions.

- Wrong screenshots.

- Sample code running error, or running results inconsistent with the expectation.

Risk Warnings

- Risk Warnings:

- Lack of risk warnings for operations that may damage the system or important data.

Content Compliance

- Content Compliance:

- Contents that may violate applicable laws and regulations or geo-cultural context-sensitive words and expressions.

- Copyright infringement.

Please select the type of question

Problem description

Describe the bug so that we can quickly locate the problem.

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 CPU

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]

Compute the inverse mapping of underlying Bijector, namely Y=h(X)=g1(X) .

Parameters

  • x (Tensor) - the value of output after mapping by the underlying bijector.

Returns

Tensor, the inverse mapping of underlying Bijector.

forward_log_jacobian(x)[source]

Compute the log value of the inverse mapping of underlying Bijector logdg1(x)/dx.

Parameters

  • x (Tensor) - the value of output after mapping by the underlying bijector.

Returns

Tensor, the log value of the inverse mapping of underlying Bijector.

inverse(y)[source]

Compute the forward mapping of underlying Bijector, namely Y=g(X).

Parameters

  • y (Tensor) - the value to compute by the underlying bijector.

Returns

Tensor, the forward mapping of underlying Bijector.

inverse_log_jacobian(y)[source]

Compute the log value of the forward mapping of underlying Bijector, namely Y=logdg(x)/dx.

Parameters

  • y (Tensor) - the value to compute by the underlying bijector.

Returns

Tensor, the log value of forward mapping of underlying Bijector.