From 7ee1662420732667ec47c9af2cf942152bb0fc33 Mon Sep 17 00:00:00 2001 From: Xun Deng Date: Sun, 15 Nov 2020 11:32:37 -0500 Subject: [PATCH] fix doc issues in bijector classes --- mindspore/nn/probability/bijector/exp.py | 22 ++++++++--------- .../nn/probability/bijector/gumbel_cdf.py | 22 ++++++++--------- mindspore/nn/probability/bijector/invert.py | 24 +++++++++---------- .../probability/bijector/power_transform.py | 22 ++++++++--------- .../nn/probability/bijector/scalar_affine.py | 22 ++++++++--------- mindspore/nn/probability/bijector/softplus.py | 24 +++++++++---------- 6 files changed, 68 insertions(+), 68 deletions(-) diff --git a/mindspore/nn/probability/bijector/exp.py b/mindspore/nn/probability/bijector/exp.py index 96a349e897..9cb2159590 100644 --- a/mindspore/nn/probability/bijector/exp.py +++ b/mindspore/nn/probability/bijector/exp.py @@ -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, diff --git a/mindspore/nn/probability/bijector/gumbel_cdf.py b/mindspore/nn/probability/bijector/gumbel_cdf.py index a2f5304874..1579111251 100644 --- a/mindspore/nn/probability/bijector/gumbel_cdf.py +++ b/mindspore/nn/probability/bijector/gumbel_cdf.py @@ -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, diff --git a/mindspore/nn/probability/bijector/invert.py b/mindspore/nn/probability/bijector/invert.py index 3cb63a9b5e..31483299bc 100644 --- a/mindspore/nn/probability/bijector/invert.py +++ b/mindspore/nn/probability/bijector/invert.py @@ -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, diff --git a/mindspore/nn/probability/bijector/power_transform.py b/mindspore/nn/probability/bijector/power_transform.py index 9a2ba0e264..edd5901011 100644 --- a/mindspore/nn/probability/bijector/power_transform.py +++ b/mindspore/nn/probability/bijector/power_transform.py @@ -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, diff --git a/mindspore/nn/probability/bijector/scalar_affine.py b/mindspore/nn/probability/bijector/scalar_affine.py index 94f7865daa..eeb1721529 100644 --- a/mindspore/nn/probability/bijector/scalar_affine.py +++ b/mindspore/nn/probability/bijector/scalar_affine.py @@ -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, diff --git a/mindspore/nn/probability/bijector/softplus.py b/mindspore/nn/probability/bijector/softplus.py index 17aa498aca..0e9a6b19bc 100644 --- a/mindspore/nn/probability/bijector/softplus.py +++ b/mindspore/nn/probability/bijector/softplus.py @@ -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,