|
|
@ -24,6 +24,7 @@ from mindspore import Tensor
|
|
|
|
from mindspore.common import dtype as mstype
|
|
|
|
from mindspore.common import dtype as mstype
|
|
|
|
from mindspore.ops import composite as C
|
|
|
|
from mindspore.ops import composite as C
|
|
|
|
from mindspore.ops import operations as P
|
|
|
|
from mindspore.ops import operations as P
|
|
|
|
|
|
|
|
from mindspore.ops import functional as F
|
|
|
|
from mindspore.ops import prim_attr_register, PrimitiveWithInfer
|
|
|
|
from mindspore.ops import prim_attr_register, PrimitiveWithInfer
|
|
|
|
from ..ut_filter import non_graph_engine
|
|
|
|
from ..ut_filter import non_graph_engine
|
|
|
|
from ....mindspore_test_framework.mindspore_test import mindspore_test
|
|
|
|
from ....mindspore_test_framework.mindspore_test import mindspore_test
|
|
|
@ -41,6 +42,7 @@ context.set_context(mode=context.GRAPH_MODE)
|
|
|
|
|
|
|
|
|
|
|
|
grad = C.GradOperation()
|
|
|
|
grad = C.GradOperation()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_multiply():
|
|
|
|
def test_multiply():
|
|
|
|
""" test_multiply """
|
|
|
|
""" test_multiply """
|
|
|
|
input_x = Tensor(np.array([[-0.1, 0.3, 3.6], [0.4, 0.5, -3.2]]))
|
|
|
|
input_x = Tensor(np.array([[-0.1, 0.3, 3.6], [0.4, 0.5, -3.2]]))
|
|
|
@ -138,6 +140,13 @@ def test_eye():
|
|
|
|
assert np.all(eye_output.asnumpy() == expect)
|
|
|
|
assert np.all(eye_output.asnumpy() == expect)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_arange():
|
|
|
|
|
|
|
|
""" test_arange """
|
|
|
|
|
|
|
|
F.arange(10)
|
|
|
|
|
|
|
|
F.arange(1, 5)
|
|
|
|
|
|
|
|
F.arange(1, 10, 2)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class VirtualLossGrad(PrimitiveWithInfer):
|
|
|
|
class VirtualLossGrad(PrimitiveWithInfer):
|
|
|
|
""" VirtualLossGrad definition """
|
|
|
|
""" VirtualLossGrad definition """
|
|
|
|
|
|
|
|
|
|
|
|