Browse Source

!8609 Fix doc issues in Bijectors

From: @shallydeng
Reviewed-by: @zichun_ye,@wang_zi_dong
Signed-off-by: @zichun_ye
tags/v1.1.0
mindspore-ci-bot Gitee 5 years ago
parent
commit
752c59b945
6 changed files with 68 additions and 68 deletions
  1. +11
    -11
      mindspore/nn/probability/bijector/exp.py
  2. +11
    -11
      mindspore/nn/probability/bijector/gumbel_cdf.py
  3. +12
    -12
      mindspore/nn/probability/bijector/invert.py
  4. +11
    -11
      mindspore/nn/probability/bijector/power_transform.py
  5. +11
    -11
      mindspore/nn/probability/bijector/scalar_affine.py
  6. +12
    -12
      mindspore/nn/probability/bijector/softplus.py

+ 11
- 11
mindspore/nn/probability/bijector/exp.py View File

@@ -34,17 +34,17 @@ class Exp(PowerTransform):
>>>
>>> # To use an Exp bijector in a network.
>>> class net(Cell):
>>> def __init__(self):
>>> super(net, self).__init__():
>>> self.e1 = msb.Exp()
>>>
>>> def construct(self, value):
>>> # Similar calls can be made to other functions
>>> # by replacing `forward` by the name of the function.
>>> ans1 = self.s1.forward(value)
>>> ans2 = self.s1.inverse(value)
>>> ans3 = self.s1.forward_log_jacobian(value)
>>> ans4 = self.s1.inverse_log_jacobian(value)
... def __init__(self):
... super(net, self).__init__():
... self.e1 = msb.Exp()
...
... def construct(self, value):
... # Similar calls can be made to other functions
... # by replacing `forward` by the name of the function.
... ans1 = self.s1.forward(value)
... ans2 = self.s1.inverse(value)
... ans3 = self.s1.forward_log_jacobian(value)
... ans4 = self.s1.inverse_log_jacobian(value)
"""

def __init__(self,


+ 11
- 11
mindspore/nn/probability/bijector/gumbel_cdf.py View File

@@ -42,17 +42,17 @@ class GumbelCDF(Bijector):
>>>
>>> # To use GumbelCDF bijector in a network.
>>> class net(Cell):
>>> def __init__(self):
>>> super(net, self).__init__():
>>> self.gum = msb.GumbelCDF(0.0, 1.0)
>>>
>>> def construct(self, value):
>>> # Similar calls can be made to other functions
>>> # by replacing 'forward' by the name of the function.
>>> ans1 = self.gum.forward(value)
>>> ans2 = self.gum.inverse(value)
>>> ans3 = self.gum.forward_log_jacobian(value)
>>> ans4 = self.gum.inverse_log_jacobian(value)
... def __init__(self):
... super(net, self).__init__():
... self.gum = msb.GumbelCDF(0.0, 1.0)
...
... def construct(self, value):
... # Similar calls can be made to other functions
... # by replacing 'forward' by the name of the function.
... ans1 = self.gum.forward(value)
... ans2 = self.gum.inverse(value)
... ans3 = self.gum.forward_log_jacobian(value)
... ans4 = self.gum.inverse_log_jacobian(value)
"""

def __init__(self,


+ 12
- 12
mindspore/nn/probability/bijector/invert.py View File

@@ -28,21 +28,21 @@ class Invert(Bijector):
Examples:
>>> # To initialize an Invert bijector.
>>> import mindspore.nn.probability.bijector as msb
>>> n = msb.Invert()
>>> n = msb.Invert(msb.Exp())
>>>
>>> # To use an Invert bijector in a network.
>>> class net(Cell):
>>> def __init__(self):
>>> super(net, self).__init__():
>>> self.inv = msb.Invert(msb.Exp())
>>>
>>> def construct(self, value):
>>> # Similar calls can be made to other functions
>>> # by replacing `forward` by the name of the function.
>>> ans1 = self.inv.forward(value)
>>> ans2 = self.inv.inverse(value)
>>> ans3 = self.inv.forward_log_jacobian(value)
>>> ans4 = self.inv.inverse_log_jacobian(value)
... def __init__(self):
... super(net, self).__init__():
... self.inv = msb.Invert(msb.Exp())
...
... def construct(self, value):
... # Similar calls can be made to other functions
... # by replacing `forward` by the name of the function.
... ans1 = self.inv.forward(value)
... ans2 = self.inv.inverse(value)
... ans3 = self.inv.forward_log_jacobian(value)
... ans4 = self.inv.inverse_log_jacobian(value)
"""

def __init__(self,


+ 11
- 11
mindspore/nn/probability/bijector/power_transform.py View File

@@ -46,17 +46,17 @@ class PowerTransform(Bijector):
>>>
>>> # To use a PowerTransform bijector in a network.
>>> class net(Cell):
>>> def __init__(self):
>>> super(net, self).__init__():
>>> self.p1 = msb.PowerTransform(0.5)
>>>
>>> def construct(self, value):
>>> # Similar calls can be made to other functions
>>> # by replacing 'forward' by the name of the function.
>>> ans1 = self.s1.forward(value)
>>> ans2 = self.s1.inverse(value)
>>> ans3 = self.s1.forward_log_jacobian(value)
>>> ans4 = self.s1.inverse_log_jacobian(value)
... def __init__(self):
... super(net, self).__init__():
... self.p1 = msb.PowerTransform(0.5)
...
... def construct(self, value):
... # Similar calls can be made to other functions
... # by replacing 'forward' by the name of the function.
... ans1 = self.s1.forward(value)
... ans2 = self.s1.inverse(value)
... ans3 = self.s1.forward_log_jacobian(value)
... ans4 = self.s1.inverse_log_jacobian(value)
"""

def __init__(self,


+ 11
- 11
mindspore/nn/probability/bijector/scalar_affine.py View File

@@ -42,17 +42,17 @@ class ScalarAffine(Bijector):
>>>
>>> # To use a ScalarAffine bijector in a network.
>>> class net(Cell):
>>> def __init__(self):
>>> super(net, self).__init__():
>>> self.s1 = nn.probability.bijector.ScalarAffine(1, 2)
>>>
>>> def construct(self, value):
>>> # Similar calls can be made to other functions
>>> # by replacing 'forward' by the name of the function.
>>> ans1 = self.s1.forward(value)
>>> ans2 = self.s1.inverse(value)
>>> ans3 = self.s1.forward_log_jacobian(value)
>>> ans4 = self.s1.inverse_log_jacobian(value)
... def __init__(self):
... super(net, self).__init__():
... self.s1 = nn.probability.bijector.ScalarAffine(1, 2)
...
... def construct(self, value):
... # Similar calls can be made to other functions
... # by replacing 'forward' by the name of the function.
... ans1 = self.s1.forward(value)
... ans2 = self.s1.inverse(value)
... ans3 = self.s1.forward_log_jacobian(value)
... ans4 = self.s1.inverse_log_jacobian(value)
"""

def __init__(self,


+ 12
- 12
mindspore/nn/probability/bijector/softplus.py View File

@@ -35,21 +35,21 @@ class Softplus(Bijector):

Examples:
>>> # To initialize a Softplus bijector of sharpness 2.
>>> softplus = nn.probability.bijector.Softfplus(2)
>>> softplus = nn.probability.bijector.Softplus(2)
>>>
>>> # To use ScalarAffine bijector in a network.
>>> class net(Cell):
>>> def __init__(self):
>>> super(net, self).__init__():
>>> self.sp1 = nn.probability.bijector.Softflus(2)
>>>
>>> def construct(self, value):
>>> # Similar calls can be made to other functions
>>> # by replacing 'forward' by the name of the function.
>>> ans1 = self.sp1.forward(value)
>>> ans2 = self.sp1.inverse(value)
>>> ans3 = self.sp1.forward_log_jacobian(value)
>>> ans4 = self.sp1.inverse_log_jacobian(value)
... def __init__(self):
... super(net, self).__init__():
... self.sp1 = nn.probability.bijector.Softplus(2.)
...
... def construct(self, value):
... # Similar calls can be made to other functions
... # by replacing 'forward' by the name of the function.
... ans1 = self.sp1.forward(value)
... ans2 = self.sp1.inverse(value)
... ans3 = self.sp1.forward_log_jacobian(value)
... ans4 = self.sp1.inverse_log_jacobian(value)
"""

def __init__(self,


Loading…
Cancel
Save