diff --git a/mindspore/ops/composite/base.py b/mindspore/ops/composite/base.py index 37c5f4a3c8..044c56f8de 100644 --- a/mindspore/ops/composite/base.py +++ b/mindspore/ops/composite/base.py @@ -75,6 +75,15 @@ def core(fn=None, **flags): fn (Function): Function to add flag. Default: None. flags (dict): The following flags can be set core, which indicates that this is a core function or other flag. Default: None. + + Supported Platforms: + ``Ascend`` ``GPU`` + + Examples: + >>> net = Net() + >>> net = core(net, predit=True) + >>> print(hasattr(net, '_mindspore_flags')) + True """ # need set the attr and access on c++ diff --git a/mindspore/ops/composite/clip_ops.py b/mindspore/ops/composite/clip_ops.py index 8f1b1c9af5..b68b5f26c1 100644 --- a/mindspore/ops/composite/clip_ops.py +++ b/mindspore/ops/composite/clip_ops.py @@ -42,6 +42,22 @@ def clip_by_value(x, clip_value_min, clip_value_max): Returns: Tensor, a clipped Tensor. + + Supported Platforms: + ``Ascend`` ``GPU`` + + Examples: + >>> import numpy as np + >>> from mindspore import Tensor + >>> from mindspore.ops import composite as C + >>> import mindspore.common.dtype as mstype + >>> min_value = Tensor(5, mstype.float32) + >>> max_value = Tensor(20, mstype.float32) + >>> x = Tensor(np.array([[1., 25., 5., 7.], [4., 11., 6., 21.]]), mstype.float32) + >>> output = C.clip_by_value(x, min_value, max_value) + >>> print(output) + [[ 5. 20. 5. 7.] + [ 5. 11. 6. 20.]] """ min_op = P.Minimum() max_op = P.Maximum()