diff --git a/tests/st/ops/davinci/test_add.py b/tests/st/ops/ascend/test_add.py similarity index 100% rename from tests/st/ops/davinci/test_add.py rename to tests/st/ops/ascend/test_add.py diff --git a/tests/st/ops/davinci/test_addn.py b/tests/st/ops/ascend/test_addn.py similarity index 100% rename from tests/st/ops/davinci/test_addn.py rename to tests/st/ops/ascend/test_addn.py diff --git a/tests/st/ops/davinci/test_apply_momentum.py b/tests/st/ops/ascend/test_apply_momentum.py similarity index 97% rename from tests/st/ops/davinci/test_apply_momentum.py rename to tests/st/ops/ascend/test_apply_momentum.py index 885356ce48..e20c4f4746 100644 --- a/tests/st/ops/davinci/test_apply_momentum.py +++ b/tests/st/ops/ascend/test_apply_momentum.py @@ -1,44 +1,44 @@ -# Copyright 2019 Huawei Technologies Co., Ltd -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============================================================================ -from mindspore import Tensor -from mindspore.ops import operations as P -import mindspore.nn as nn -from mindspore.common.api import ms_function -import numpy as np -import mindspore.context as context -from mindspore.common.initializer import initializer -from mindspore.common.parameter import Parameter -context.set_context(mode=context.GRAPH_MODE, device_target="Ascend") -class Net(nn.Cell): - def __init__(self): - super(Net, self).__init__() - self.apply_momentum = P.ApplyMomentum(gradient_scale=1024.0) - self.variable = Parameter(initializer( - 'normal', [2, 3, 3, 4]), name='variable') - self.accumulation = Parameter(initializer( - 'normal', [2, 3, 3, 4]), name='accumulation') - self.learning_rate = Parameter(initializer( - 'normal', [1, ]), name='learning_rate') - self.gradient = Parameter(initializer( - 'normal', [2, 3, 3, 4]), name='gradient') - self.momentum = Parameter(initializer( - 'normal', [1, ]), name='momentum') - def construct(self): - return self.apply_momentum(self.variable, self.accumulation, self.learning_rate, self.gradient, self.momentum) - -def test_net(): - apply_momentum = Net() - output = apply_momentum() - print(output.asnumpy()) +# Copyright 2019 Huawei Technologies Co., Ltd +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================ +from mindspore import Tensor +from mindspore.ops import operations as P +import mindspore.nn as nn +from mindspore.common.api import ms_function +import numpy as np +import mindspore.context as context +from mindspore.common.initializer import initializer +from mindspore.common.parameter import Parameter +context.set_context(mode=context.GRAPH_MODE, device_target="Ascend") +class Net(nn.Cell): + def __init__(self): + super(Net, self).__init__() + self.apply_momentum = P.ApplyMomentum(gradient_scale=1024.0) + self.variable = Parameter(initializer( + 'normal', [2, 3, 3, 4]), name='variable') + self.accumulation = Parameter(initializer( + 'normal', [2, 3, 3, 4]), name='accumulation') + self.learning_rate = Parameter(initializer( + 'normal', [1, ]), name='learning_rate') + self.gradient = Parameter(initializer( + 'normal', [2, 3, 3, 4]), name='gradient') + self.momentum = Parameter(initializer( + 'normal', [1, ]), name='momentum') + def construct(self): + return self.apply_momentum(self.variable, self.accumulation, self.learning_rate, self.gradient, self.momentum) + +def test_net(): + apply_momentum = Net() + output = apply_momentum() + print(output.asnumpy()) diff --git a/tests/st/ops/davinci/test_argmax.py b/tests/st/ops/ascend/test_argmax.py similarity index 100% rename from tests/st/ops/davinci/test_argmax.py rename to tests/st/ops/ascend/test_argmax.py diff --git a/tests/st/ops/davinci/test_biasAddGrad.py b/tests/st/ops/ascend/test_biasAddGrad.py similarity index 97% rename from tests/st/ops/davinci/test_biasAddGrad.py rename to tests/st/ops/ascend/test_biasAddGrad.py index 29b63ac336..f2e8f7a9bc 100644 --- a/tests/st/ops/davinci/test_biasAddGrad.py +++ b/tests/st/ops/ascend/test_biasAddGrad.py @@ -1,42 +1,42 @@ -# Copyright 2019 Huawei Technologies Co., Ltd -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============================================================================ -from mindspore import Tensor -from mindspore.ops import operations as P -from mindspore.ops.operations import _grad_ops as G -import mindspore.nn as nn -from mindspore.common.api import ms_function -import numpy as np -import mindspore.context as context -from mindspore.common.initializer import initializer -from mindspore.common.parameter import Parameter -context.set_context(device_target="Ascend") -class Net(nn.Cell): - def __init__(self): - super(Net, self).__init__() - self.bias_add_grad = G.BiasAddGrad() - #self.dout = Parameter(initializer( - #'normal', [2, 3, 3, 4]), name='dout') - - - @ms_function - def construct(self, dout): - return self.bias_add_grad(dout) - -dout = np.ones([2,3,4,4]).astype(np.float32) -bias_add_grad = Net() -output = bias_add_grad(Tensor(dout)) -expect_output = np.array([32.,32.,32.]).astype(np.float32) -assert np.all(output.asnumpy()==expect_output), "bias_add_grad execute failed, please check current code commit" -print(output.asnumpy()) +# Copyright 2019 Huawei Technologies Co., Ltd +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================ +from mindspore import Tensor +from mindspore.ops import operations as P +from mindspore.ops.operations import _grad_ops as G +import mindspore.nn as nn +from mindspore.common.api import ms_function +import numpy as np +import mindspore.context as context +from mindspore.common.initializer import initializer +from mindspore.common.parameter import Parameter +context.set_context(device_target="Ascend") +class Net(nn.Cell): + def __init__(self): + super(Net, self).__init__() + self.bias_add_grad = G.BiasAddGrad() + #self.dout = Parameter(initializer( + #'normal', [2, 3, 3, 4]), name='dout') + + + @ms_function + def construct(self, dout): + return self.bias_add_grad(dout) + +dout = np.ones([2,3,4,4]).astype(np.float32) +bias_add_grad = Net() +output = bias_add_grad(Tensor(dout)) +expect_output = np.array([32.,32.,32.]).astype(np.float32) +assert np.all(output.asnumpy()==expect_output), "bias_add_grad execute failed, please check current code commit" +print(output.asnumpy()) diff --git a/tests/st/ops/davinci/test_bias_add_grad.py b/tests/st/ops/ascend/test_bias_add_grad.py similarity index 97% rename from tests/st/ops/davinci/test_bias_add_grad.py rename to tests/st/ops/ascend/test_bias_add_grad.py index e58d376e93..c6a51d8b3b 100644 --- a/tests/st/ops/davinci/test_bias_add_grad.py +++ b/tests/st/ops/ascend/test_bias_add_grad.py @@ -1,39 +1,39 @@ -# Copyright 2019 Huawei Technologies Co., Ltd -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============================================================================ -from mindspore import Tensor -from mindspore.ops import operations as P -from mindspore.ops.operations import _grad_ops as G -import mindspore.nn as nn -from mindspore.common.api import ms_function -import numpy as np -import mindspore.context as context -from mindspore.common.initializer import initializer -from mindspore.common.parameter import Parameter -context.set_context(device_target="Ascend") -class Net(nn.Cell): - def __init__(self): - super(Net, self).__init__() - self.bias_add_grad = G.BiasAddGrad() - - - @ms_function - def construct(self, dout): - return self.bias_add_grad(dout) - -def test_net(): - dout = np.random.rand(1, 1001).astype(np.float32) - bias_add_grad = Net() - output = bias_add_grad(dout) - print(output.asnumpy()) +# Copyright 2019 Huawei Technologies Co., Ltd +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================ +from mindspore import Tensor +from mindspore.ops import operations as P +from mindspore.ops.operations import _grad_ops as G +import mindspore.nn as nn +from mindspore.common.api import ms_function +import numpy as np +import mindspore.context as context +from mindspore.common.initializer import initializer +from mindspore.common.parameter import Parameter +context.set_context(device_target="Ascend") +class Net(nn.Cell): + def __init__(self): + super(Net, self).__init__() + self.bias_add_grad = G.BiasAddGrad() + + + @ms_function + def construct(self, dout): + return self.bias_add_grad(dout) + +def test_net(): + dout = np.random.rand(1, 1001).astype(np.float32) + bias_add_grad = Net() + output = bias_add_grad(dout) + print(output.asnumpy()) diff --git a/tests/st/ops/davinci/test_conv.py b/tests/st/ops/ascend/test_conv.py similarity index 100% rename from tests/st/ops/davinci/test_conv.py rename to tests/st/ops/ascend/test_conv.py diff --git a/tests/st/ops/davinci/test_conv2dGradFilter.py b/tests/st/ops/ascend/test_conv2dGradFilter.py similarity index 100% rename from tests/st/ops/davinci/test_conv2dGradFilter.py rename to tests/st/ops/ascend/test_conv2dGradFilter.py diff --git a/tests/st/ops/davinci/test_conv_grad.py b/tests/st/ops/ascend/test_conv_grad.py similarity index 100% rename from tests/st/ops/davinci/test_conv_grad.py rename to tests/st/ops/ascend/test_conv_grad.py diff --git a/tests/st/ops/davinci/test_dense.py b/tests/st/ops/ascend/test_dense.py similarity index 100% rename from tests/st/ops/davinci/test_dense.py rename to tests/st/ops/ascend/test_dense.py diff --git a/tests/st/ops/davinci/test_dense_grad.py b/tests/st/ops/ascend/test_dense_grad.py similarity index 100% rename from tests/st/ops/davinci/test_dense_grad.py rename to tests/st/ops/ascend/test_dense_grad.py diff --git a/tests/st/ops/davinci/test_drop_out_gen_mask.py b/tests/st/ops/ascend/test_drop_out_gen_mask.py similarity index 97% rename from tests/st/ops/davinci/test_drop_out_gen_mask.py rename to tests/st/ops/ascend/test_drop_out_gen_mask.py index 4d7c555219..ce7ebbfbe0 100644 --- a/tests/st/ops/davinci/test_drop_out_gen_mask.py +++ b/tests/st/ops/ascend/test_drop_out_gen_mask.py @@ -1,44 +1,44 @@ -# Copyright 2020 Huawei Technologies Co., Ltd -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============================================================================ -from mindspore import Tensor -from mindspore.ops import operations as P -import mindspore.nn as nn -import numpy as np -import mindspore.context as context -context.set_context(mode=context.GRAPH_MODE, - device_target="Ascend") - - -class Net(nn.Cell): - def __init__(self): - super(Net, self).__init__() - self.mask = P.DropoutGenMask(10, 28) - self.shape = P.Shape() - - def construct(self, x, y): - shape_x = self.shape(x) - return self.mask(shape_x, y) - - -x = np.ones([2, 4, 2, 2]).astype(np.int32) -y = np.array([1.0]).astype(np.float32) - - -def test_net(): - mask = Net() - tx, ty = Tensor(x), Tensor(y) - output = mask(tx, ty) - print(output.asnumpy()) - assert ([255, 255, 255, 255] == output.asnumpy()).all() +# Copyright 2020 Huawei Technologies Co., Ltd +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================ +from mindspore import Tensor +from mindspore.ops import operations as P +import mindspore.nn as nn +import numpy as np +import mindspore.context as context +context.set_context(mode=context.GRAPH_MODE, + device_target="Ascend") + + +class Net(nn.Cell): + def __init__(self): + super(Net, self).__init__() + self.mask = P.DropoutGenMask(10, 28) + self.shape = P.Shape() + + def construct(self, x, y): + shape_x = self.shape(x) + return self.mask(shape_x, y) + + +x = np.ones([2, 4, 2, 2]).astype(np.int32) +y = np.array([1.0]).astype(np.float32) + + +def test_net(): + mask = Net() + tx, ty = Tensor(x), Tensor(y) + output = mask(tx, ty) + print(output.asnumpy()) + assert ([255, 255, 255, 255] == output.asnumpy()).all() diff --git a/tests/st/ops/davinci/test_equal_count.py b/tests/st/ops/ascend/test_equal_count.py similarity index 100% rename from tests/st/ops/davinci/test_equal_count.py rename to tests/st/ops/ascend/test_equal_count.py diff --git a/tests/st/ops/davinci/test_full_connection.py b/tests/st/ops/ascend/test_full_connection.py similarity index 100% rename from tests/st/ops/davinci/test_full_connection.py rename to tests/st/ops/ascend/test_full_connection.py diff --git a/tests/st/ops/davinci/test_fused_batchnorm.py b/tests/st/ops/ascend/test_fused_batchnorm.py similarity index 100% rename from tests/st/ops/davinci/test_fused_batchnorm.py rename to tests/st/ops/ascend/test_fused_batchnorm.py diff --git a/tests/st/ops/davinci/test_fused_batchnorm_grad.py b/tests/st/ops/ascend/test_fused_batchnorm_grad.py similarity index 100% rename from tests/st/ops/davinci/test_fused_batchnorm_grad.py rename to tests/st/ops/ascend/test_fused_batchnorm_grad.py diff --git a/tests/st/ops/davinci/test_image_gradients.py b/tests/st/ops/ascend/test_image_gradients.py similarity index 100% rename from tests/st/ops/davinci/test_image_gradients.py rename to tests/st/ops/ascend/test_image_gradients.py diff --git a/tests/st/ops/davinci/test_matmul.py b/tests/st/ops/ascend/test_matmul.py similarity index 100% rename from tests/st/ops/davinci/test_matmul.py rename to tests/st/ops/ascend/test_matmul.py diff --git a/tests/st/ops/davinci/test_maxpool.py b/tests/st/ops/ascend/test_maxpool.py similarity index 100% rename from tests/st/ops/davinci/test_maxpool.py rename to tests/st/ops/ascend/test_maxpool.py diff --git a/tests/st/ops/davinci/test_maxpool_grad.py b/tests/st/ops/ascend/test_maxpool_grad.py similarity index 100% rename from tests/st/ops/davinci/test_maxpool_grad.py rename to tests/st/ops/ascend/test_maxpool_grad.py diff --git a/tests/st/ops/davinci/test_maxpool_with_argmax.py b/tests/st/ops/ascend/test_maxpool_with_argmax.py similarity index 100% rename from tests/st/ops/davinci/test_maxpool_with_argmax.py rename to tests/st/ops/ascend/test_maxpool_with_argmax.py diff --git a/tests/st/ops/davinci/test_maxpool_with_argmax_grad.py b/tests/st/ops/ascend/test_maxpool_with_argmax_grad.py similarity index 100% rename from tests/st/ops/davinci/test_maxpool_with_argmax_grad.py rename to tests/st/ops/ascend/test_maxpool_with_argmax_grad.py diff --git a/tests/st/ops/davinci/test_relu.py b/tests/st/ops/ascend/test_relu.py similarity index 100% rename from tests/st/ops/davinci/test_relu.py rename to tests/st/ops/ascend/test_relu.py diff --git a/tests/st/ops/davinci/test_relu_grad.py b/tests/st/ops/ascend/test_relu_grad.py similarity index 100% rename from tests/st/ops/davinci/test_relu_grad.py rename to tests/st/ops/ascend/test_relu_grad.py diff --git a/tests/st/ops/davinci/test_reshape.py b/tests/st/ops/ascend/test_reshape.py similarity index 100% rename from tests/st/ops/davinci/test_reshape.py rename to tests/st/ops/ascend/test_reshape.py diff --git a/tests/st/ops/davinci/test_simplemean.py b/tests/st/ops/ascend/test_simplemean.py similarity index 100% rename from tests/st/ops/davinci/test_simplemean.py rename to tests/st/ops/ascend/test_simplemean.py diff --git a/tests/st/ops/davinci/test_simplemean_grad.py b/tests/st/ops/ascend/test_simplemean_grad.py similarity index 100% rename from tests/st/ops/davinci/test_simplemean_grad.py rename to tests/st/ops/ascend/test_simplemean_grad.py diff --git a/tests/st/ops/davinci/test_softmax.py b/tests/st/ops/ascend/test_softmax.py similarity index 100% rename from tests/st/ops/davinci/test_softmax.py rename to tests/st/ops/ascend/test_softmax.py diff --git a/tests/st/ops/davinci/test_sparseSoftmaxCrossEntropyWithLogits.py b/tests/st/ops/ascend/test_sparseSoftmaxCrossEntropyWithLogits.py similarity index 100% rename from tests/st/ops/davinci/test_sparseSoftmaxCrossEntropyWithLogits.py rename to tests/st/ops/ascend/test_sparseSoftmaxCrossEntropyWithLogits.py diff --git a/tests/st/ops/davinci/test_sparse_softmax_cross_entropy_with_logits.py b/tests/st/ops/ascend/test_sparse_softmax_cross_entropy_with_logits.py similarity index 100% rename from tests/st/ops/davinci/test_sparse_softmax_cross_entropy_with_logits.py rename to tests/st/ops/ascend/test_sparse_softmax_cross_entropy_with_logits.py diff --git a/tests/st/ops/davinci/test_sparse_softmax_cross_entropy_with_logits_grad.py b/tests/st/ops/ascend/test_sparse_softmax_cross_entropy_with_logits_grad.py similarity index 100% rename from tests/st/ops/davinci/test_sparse_softmax_cross_entropy_with_logits_grad.py rename to tests/st/ops/ascend/test_sparse_softmax_cross_entropy_with_logits_grad.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_AssignAdd.py b/tests/st/ops/ascend/test_tbe_ops/test_AssignAdd.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_AssignAdd.py rename to tests/st/ops/ascend/test_tbe_ops/test_AssignAdd.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_AssignSub.py b/tests/st/ops/ascend/test_tbe_ops/test_AssignSub.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_AssignSub.py rename to tests/st/ops/ascend/test_tbe_ops/test_AssignSub.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_ReduceMean.py b/tests/st/ops/ascend/test_tbe_ops/test_ReduceMean.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_ReduceMean.py rename to tests/st/ops/ascend/test_tbe_ops/test_ReduceMean.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_add.py b/tests/st/ops/ascend/test_tbe_ops/test_add.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_add.py rename to tests/st/ops/ascend/test_tbe_ops/test_add.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_addn.py b/tests/st/ops/ascend/test_tbe_ops/test_addn.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_addn.py rename to tests/st/ops/ascend/test_tbe_ops/test_addn.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_apply_adam.py b/tests/st/ops/ascend/test_tbe_ops/test_apply_adam.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_apply_adam.py rename to tests/st/ops/ascend/test_tbe_ops/test_apply_adam.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_apply_momentum.py b/tests/st/ops/ascend/test_tbe_ops/test_apply_momentum.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_apply_momentum.py rename to tests/st/ops/ascend/test_tbe_ops/test_apply_momentum.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_batchmatmul.py b/tests/st/ops/ascend/test_tbe_ops/test_batchmatmul.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_batchmatmul.py rename to tests/st/ops/ascend/test_tbe_ops/test_batchmatmul.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_batchnorm.py b/tests/st/ops/ascend/test_tbe_ops/test_batchnorm.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_batchnorm.py rename to tests/st/ops/ascend/test_tbe_ops/test_batchnorm.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_batchnorm_grad.py b/tests/st/ops/ascend/test_tbe_ops/test_batchnorm_grad.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_batchnorm_grad.py rename to tests/st/ops/ascend/test_tbe_ops/test_batchnorm_grad.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_bias_add.py b/tests/st/ops/ascend/test_tbe_ops/test_bias_add.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_bias_add.py rename to tests/st/ops/ascend/test_tbe_ops/test_bias_add.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_bias_add_grad.py b/tests/st/ops/ascend/test_tbe_ops/test_bias_add_grad.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_bias_add_grad.py rename to tests/st/ops/ascend/test_tbe_ops/test_bias_add_grad.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_concat.py b/tests/st/ops/ascend/test_tbe_ops/test_concat.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_concat.py rename to tests/st/ops/ascend/test_tbe_ops/test_concat.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_conv.py b/tests/st/ops/ascend/test_tbe_ops/test_conv.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_conv.py rename to tests/st/ops/ascend/test_tbe_ops/test_conv.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_conv2d_backprop_filter.py b/tests/st/ops/ascend/test_tbe_ops/test_conv2d_backprop_filter.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_conv2d_backprop_filter.py rename to tests/st/ops/ascend/test_tbe_ops/test_conv2d_backprop_filter.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_conv2d_backprop_input.py b/tests/st/ops/ascend/test_tbe_ops/test_conv2d_backprop_input.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_conv2d_backprop_input.py rename to tests/st/ops/ascend/test_tbe_ops/test_conv2d_backprop_input.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_dropout_do_mask.py b/tests/st/ops/ascend/test_tbe_ops/test_dropout_do_mask.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_dropout_do_mask.py rename to tests/st/ops/ascend/test_tbe_ops/test_dropout_do_mask.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_gelu.py b/tests/st/ops/ascend/test_tbe_ops/test_gelu.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_gelu.py rename to tests/st/ops/ascend/test_tbe_ops/test_gelu.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_gelu_grad_sens.py b/tests/st/ops/ascend/test_tbe_ops/test_gelu_grad_sens.py old mode 100755 new mode 100644 similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_gelu_grad_sens.py rename to tests/st/ops/ascend/test_tbe_ops/test_gelu_grad_sens.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_greater.py b/tests/st/ops/ascend/test_tbe_ops/test_greater.py similarity index 95% rename from tests/st/ops/davinci/test_tbe_ops/test_greater.py rename to tests/st/ops/ascend/test_tbe_ops/test_greater.py index 3976ad4301..b9dae700c2 100644 --- a/tests/st/ops/davinci/test_tbe_ops/test_greater.py +++ b/tests/st/ops/ascend/test_tbe_ops/test_greater.py @@ -1,51 +1,51 @@ -# Copyright 2020 Huawei Technologies Co., Ltd -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============================================================================ -import numpy as np -import pytest -from mindspore.ops import operations as P -from mindspore.nn import Cell -from mindspore.common.tensor import Tensor -from mindspore.train.model import Model -from mindspore import log as logger -from mindspore import context -context.set_context(mode=context.GRAPH_MODE, device_target="Ascend") - -class Greater(Cell): - def __init__(self): - super(Greater, self).__init__() - self.greater = P.Greater() - - def construct(self, inputa, inputb): - return self.greater(inputa, inputb) - -def me_greater(inputa, inputb): - net = Greater() - net.set_train() - model = Model(net) - - out = model.predict(inputa, inputb) - logger.info("Check input a: ") - logger.info(inputa) - logger.info("Check input b: ") - logger.info(inputb) - return out.asnumpy() - -@pytest.mark.ssd_tbe -def test_greater_2d_scalar0(): - a = np.random.randint(-5, 5, [8, 32]).astype(np.int32) - b = np.random.randint(-5, 5, [8, 32]).astype(np.int32) - out_me = me_greater(Tensor(a), Tensor(b)) - logger.info("Check me result:") +# Copyright 2020 Huawei Technologies Co., Ltd +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================ +import numpy as np +import pytest +from mindspore.ops import operations as P +from mindspore.nn import Cell +from mindspore.common.tensor import Tensor +from mindspore.train.model import Model +from mindspore import log as logger +from mindspore import context +context.set_context(mode=context.GRAPH_MODE, device_target="Ascend") + +class Greater(Cell): + def __init__(self): + super(Greater, self).__init__() + self.greater = P.Greater() + + def construct(self, inputa, inputb): + return self.greater(inputa, inputb) + +def me_greater(inputa, inputb): + net = Greater() + net.set_train() + model = Model(net) + + out = model.predict(inputa, inputb) + logger.info("Check input a: ") + logger.info(inputa) + logger.info("Check input b: ") + logger.info(inputb) + return out.asnumpy() + +@pytest.mark.ssd_tbe +def test_greater_2d_scalar0(): + a = np.random.randint(-5, 5, [8, 32]).astype(np.int32) + b = np.random.randint(-5, 5, [8, 32]).astype(np.int32) + out_me = me_greater(Tensor(a), Tensor(b)) + logger.info("Check me result:") logger.info(out_me) \ No newline at end of file diff --git a/tests/st/ops/davinci/test_tbe_ops/test_layernorm.py b/tests/st/ops/ascend/test_tbe_ops/test_layernorm.py similarity index 97% rename from tests/st/ops/davinci/test_tbe_ops/test_layernorm.py rename to tests/st/ops/ascend/test_tbe_ops/test_layernorm.py index 586c02cc1e..f3e4e43958 100644 --- a/tests/st/ops/davinci/test_tbe_ops/test_layernorm.py +++ b/tests/st/ops/ascend/test_tbe_ops/test_layernorm.py @@ -1,55 +1,55 @@ -# Copyright 2020 Huawei Technologies Co., Ltd -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============================================================================ -import numpy as np -from mindspore.nn import LayerNorm -from mindspore.common.tensor import Tensor -from mindspore.nn import Cell -from mindspore.train.model import Model -from mindspore import log as logger -import pytest -from mindspore import context -context.set_context(mode=context.GRAPH_MODE, device_target="Ascend") - -class Net(Cell): - def __init__(self, input_shape, begin_norm_axis, begin_params_axis, gamma, beta): - super(Net, self).__init__() - self.layernorm = LayerNorm(input_shape, begin_norm_axis, begin_params_axis, gamma, beta) - - def construct(self, input): - x = self.layernorm(input) - return x - -def pt_me_layernorm(input_data, normalized_shape, gamma, beta, axis): - net = Net(normalized_shape, begin_norm_axis=axis, - begin_params_axis=axis, - gamma=Tensor(gamma), - beta=Tensor(beta)) - net.set_train() - model = Model(net) - out_me = model.predict(Tensor(input_data)) - logger.info("Check me result:") - logger.info(out_me.asnumpy()) - -@pytest.mark.lower_bs -def test_normal_layernorm_1_128_1024_axis_2(): - """ - 2 input[1, 128, 1024],normalized_shape=[128, 1024] - """ - input_data = np.random.randn(1, 128, 1024).astype(np.float32) - gamma = np.random.randn(1024).astype(np.float32) - gamma.fill(1.1) - beta = np.random.randn(1024).astype(np.float32) - beta.fill(0.1) - pt_me_layernorm(input_data, (1024, ), gamma, beta, 2) +# Copyright 2020 Huawei Technologies Co., Ltd +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================ +import numpy as np +from mindspore.nn import LayerNorm +from mindspore.common.tensor import Tensor +from mindspore.nn import Cell +from mindspore.train.model import Model +from mindspore import log as logger +import pytest +from mindspore import context +context.set_context(mode=context.GRAPH_MODE, device_target="Ascend") + +class Net(Cell): + def __init__(self, input_shape, begin_norm_axis, begin_params_axis, gamma, beta): + super(Net, self).__init__() + self.layernorm = LayerNorm(input_shape, begin_norm_axis, begin_params_axis, gamma, beta) + + def construct(self, input): + x = self.layernorm(input) + return x + +def pt_me_layernorm(input_data, normalized_shape, gamma, beta, axis): + net = Net(normalized_shape, begin_norm_axis=axis, + begin_params_axis=axis, + gamma=Tensor(gamma), + beta=Tensor(beta)) + net.set_train() + model = Model(net) + out_me = model.predict(Tensor(input_data)) + logger.info("Check me result:") + logger.info(out_me.asnumpy()) + +@pytest.mark.lower_bs +def test_normal_layernorm_1_128_1024_axis_2(): + """ + 2 input[1, 128, 1024],normalized_shape=[128, 1024] + """ + input_data = np.random.randn(1, 128, 1024).astype(np.float32) + gamma = np.random.randn(1024).astype(np.float32) + gamma.fill(1.1) + beta = np.random.randn(1024).astype(np.float32) + beta.fill(0.1) + pt_me_layernorm(input_data, (1024, ), gamma, beta, 2) diff --git a/tests/st/ops/davinci/test_tbe_ops/test_layernorm_grad.py b/tests/st/ops/ascend/test_tbe_ops/test_layernorm_grad.py similarity index 97% rename from tests/st/ops/davinci/test_tbe_ops/test_layernorm_grad.py rename to tests/st/ops/ascend/test_tbe_ops/test_layernorm_grad.py index 9f8eefdb3f..5ae09886ce 100644 --- a/tests/st/ops/davinci/test_tbe_ops/test_layernorm_grad.py +++ b/tests/st/ops/ascend/test_tbe_ops/test_layernorm_grad.py @@ -1,65 +1,65 @@ -# Copyright 2020 Huawei Technologies Co., Ltd -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============================================================================ -import numpy as np -from mindspore.nn import LayerNorm -from mindspore.common.tensor import Tensor -from mindspore.nn import Cell -from mindspore.ops.composite import GradOperation -from mindspore import log as logger -from mindspore import context -context.set_context(mode=context.GRAPH_MODE, device_target="Ascend") - -class Grad(Cell): - def __init__(self, network): - super(Grad, self).__init__() - self.grad = GradOperation(name="get_all", get_all=True, sens_param=True) - self.network = network - - def construct(self, input, output_grad,): - gout = self.grad(self.network)(input, output_grad) - return gout - -class Net(Cell): - def __init__(self, input_shape, begin_norm_axis, begin_params_axis, gamma, beta): - super(Net, self).__init__() - self.layernorm = LayerNorm(input_shape, begin_norm_axis, begin_params_axis, gamma, beta) - - def construct(self, input): - x = self.layernorm(input) - return x - -def py_me_layernorm_grad(input_data, normalized_shape, gamma, beta, axis, gradients): - input_me = Tensor(input_data) - net_me = Grad(Net(normalized_shape, begin_norm_axis=axis, - begin_params_axis=axis, - gamma=Tensor(gamma), - beta=Tensor(beta))) - net_me.set_train() - out_pool_grad_me = Tensor(gradients) - out_grad = net_me(input_me, out_pool_grad_me) - logger.info("Check me result:") - logger.info(out_grad.asnumpy()) - -def test_normal_layernorm_grad_normalize_2d(): - """ - 1 input[1, 128, 1024],normalized_shape=[1024],element_affine=False - """ - input_data = np.ones([1, 128, 1024]).astype(np.float32) - gradients = np.ones((1, 128, 1024)).astype(np.float32) - gamma = np.random.randn(1024).astype(np.float32) - gamma.fill(1.1) - beta = np.random.randn(1024).astype(np.float32) - beta.fill(0.1) - py_me_layernorm_grad(input_data, (1024,), gamma, beta, 2, gradients) +# Copyright 2020 Huawei Technologies Co., Ltd +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================ +import numpy as np +from mindspore.nn import LayerNorm +from mindspore.common.tensor import Tensor +from mindspore.nn import Cell +from mindspore.ops.composite import GradOperation +from mindspore import log as logger +from mindspore import context +context.set_context(mode=context.GRAPH_MODE, device_target="Ascend") + +class Grad(Cell): + def __init__(self, network): + super(Grad, self).__init__() + self.grad = GradOperation(name="get_all", get_all=True, sens_param=True) + self.network = network + + def construct(self, input, output_grad,): + gout = self.grad(self.network)(input, output_grad) + return gout + +class Net(Cell): + def __init__(self, input_shape, begin_norm_axis, begin_params_axis, gamma, beta): + super(Net, self).__init__() + self.layernorm = LayerNorm(input_shape, begin_norm_axis, begin_params_axis, gamma, beta) + + def construct(self, input): + x = self.layernorm(input) + return x + +def py_me_layernorm_grad(input_data, normalized_shape, gamma, beta, axis, gradients): + input_me = Tensor(input_data) + net_me = Grad(Net(normalized_shape, begin_norm_axis=axis, + begin_params_axis=axis, + gamma=Tensor(gamma), + beta=Tensor(beta))) + net_me.set_train() + out_pool_grad_me = Tensor(gradients) + out_grad = net_me(input_me, out_pool_grad_me) + logger.info("Check me result:") + logger.info(out_grad.asnumpy()) + +def test_normal_layernorm_grad_normalize_2d(): + """ + 1 input[1, 128, 1024],normalized_shape=[1024],element_affine=False + """ + input_data = np.ones([1, 128, 1024]).astype(np.float32) + gradients = np.ones((1, 128, 1024)).astype(np.float32) + gamma = np.random.randn(1024).astype(np.float32) + gamma.fill(1.1) + beta = np.random.randn(1024).astype(np.float32) + beta.fill(0.1) + py_me_layernorm_grad(input_data, (1024,), gamma, beta, 2, gradients) diff --git a/tests/st/ops/davinci/test_tbe_ops/test_less.py b/tests/st/ops/ascend/test_tbe_ops/test_less.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_less.py rename to tests/st/ops/ascend/test_tbe_ops/test_less.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_less_equal.py b/tests/st/ops/ascend/test_tbe_ops/test_less_equal.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_less_equal.py rename to tests/st/ops/ascend/test_tbe_ops/test_less_equal.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_logical_and.py b/tests/st/ops/ascend/test_tbe_ops/test_logical_and.py similarity index 97% rename from tests/st/ops/davinci/test_tbe_ops/test_logical_and.py rename to tests/st/ops/ascend/test_tbe_ops/test_logical_and.py index c9f180a56e..1df04b27d4 100644 --- a/tests/st/ops/davinci/test_tbe_ops/test_logical_and.py +++ b/tests/st/ops/ascend/test_tbe_ops/test_logical_and.py @@ -1,39 +1,39 @@ -# Copyright 2020 Huawei Technologies Co., Ltd -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============================================================================ -from mindspore import Tensor -from mindspore.ops import operations as P -import mindspore.nn as nn -from mindspore.common.api import ms_function -import numpy as np -import mindspore.context as context -context.set_context(device_target="Ascend") -class Net(nn.Cell): - def __init__(self): - super(Net, self).__init__() - self.logical_and = P.LogicalAnd() - - @ms_function - def construct(self, x1, x2): - return self.logical_and(x1, x2) - -x1 = [True, True, False, False, True, True, False, False] -x2 = [True, False, False, True, True, False, False, True] -def test_net(): - logical_and = Net() - output = logical_and(Tensor(x1), Tensor(x2)) - print(x1) - print(x2) - print(output.asnumpy()) - +# Copyright 2020 Huawei Technologies Co., Ltd +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================ +from mindspore import Tensor +from mindspore.ops import operations as P +import mindspore.nn as nn +from mindspore.common.api import ms_function +import numpy as np +import mindspore.context as context +context.set_context(device_target="Ascend") +class Net(nn.Cell): + def __init__(self): + super(Net, self).__init__() + self.logical_and = P.LogicalAnd() + + @ms_function + def construct(self, x1, x2): + return self.logical_and(x1, x2) + +x1 = [True, True, False, False, True, True, False, False] +x2 = [True, False, False, True, True, False, False, True] +def test_net(): + logical_and = Net() + output = logical_and(Tensor(x1), Tensor(x2)) + print(x1) + print(x2) + print(output.asnumpy()) + diff --git a/tests/st/ops/davinci/test_tbe_ops/test_logical_not.py b/tests/st/ops/ascend/test_tbe_ops/test_logical_not.py similarity index 97% rename from tests/st/ops/davinci/test_tbe_ops/test_logical_not.py rename to tests/st/ops/ascend/test_tbe_ops/test_logical_not.py index 97e9caa5c9..5d13a48138 100644 --- a/tests/st/ops/davinci/test_tbe_ops/test_logical_not.py +++ b/tests/st/ops/ascend/test_tbe_ops/test_logical_not.py @@ -1,38 +1,38 @@ -# Copyright 2020 Huawei Technologies Co., Ltd -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============================================================================ -from mindspore import Tensor -from mindspore.ops import operations as P -import mindspore.nn as nn -from mindspore.common.api import ms_function -import numpy as np -import mindspore.context as context -context.set_context(device_target="Ascend") -class Net(nn.Cell): - def __init__(self): - super(Net, self).__init__() - self.logical_not = P.LogicalNot() - - @ms_function - def construct(self, x1): - return self.logical_not(x1) - -x1 = [True, True, False, False, True, True, False, False] - -def test_net(): - logical_not = Net() - output = logical_not(Tensor(x1)) - print(x1) - print(output.asnumpy()) - +# Copyright 2020 Huawei Technologies Co., Ltd +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================ +from mindspore import Tensor +from mindspore.ops import operations as P +import mindspore.nn as nn +from mindspore.common.api import ms_function +import numpy as np +import mindspore.context as context +context.set_context(device_target="Ascend") +class Net(nn.Cell): + def __init__(self): + super(Net, self).__init__() + self.logical_not = P.LogicalNot() + + @ms_function + def construct(self, x1): + return self.logical_not(x1) + +x1 = [True, True, False, False, True, True, False, False] + +def test_net(): + logical_not = Net() + output = logical_not(Tensor(x1)) + print(x1) + print(output.asnumpy()) + diff --git a/tests/st/ops/davinci/test_tbe_ops/test_logical_or.py b/tests/st/ops/ascend/test_tbe_ops/test_logical_or.py similarity index 97% rename from tests/st/ops/davinci/test_tbe_ops/test_logical_or.py rename to tests/st/ops/ascend/test_tbe_ops/test_logical_or.py index e34d94c3e7..a2b7841c71 100644 --- a/tests/st/ops/davinci/test_tbe_ops/test_logical_or.py +++ b/tests/st/ops/ascend/test_tbe_ops/test_logical_or.py @@ -1,39 +1,39 @@ -# Copyright 2020 Huawei Technologies Co., Ltd -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============================================================================ -from mindspore import Tensor -from mindspore.ops import operations as P -import mindspore.nn as nn -from mindspore.common.api import ms_function -import numpy as np -import mindspore.context as context -context.set_context(device_target="Ascend") -class Net(nn.Cell): - def __init__(self): - super(Net, self).__init__() - self.logical_or = P.LogicalOr() - - @ms_function - def construct(self, x1, x2): - return self.logical_or(x1, x2) - -x1 = [True, True, False, False, True, True, False, False] -x2 = [True, False, False, True, True, False, False, True] -def test_net(): - logical_or = Net() - output = logical_or(Tensor(x1), Tensor(x2)) - print(x1) - print(x2) - print(output.asnumpy()) - +# Copyright 2020 Huawei Technologies Co., Ltd +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================ +from mindspore import Tensor +from mindspore.ops import operations as P +import mindspore.nn as nn +from mindspore.common.api import ms_function +import numpy as np +import mindspore.context as context +context.set_context(device_target="Ascend") +class Net(nn.Cell): + def __init__(self): + super(Net, self).__init__() + self.logical_or = P.LogicalOr() + + @ms_function + def construct(self, x1, x2): + return self.logical_or(x1, x2) + +x1 = [True, True, False, False, True, True, False, False] +x2 = [True, False, False, True, True, False, False, True] +def test_net(): + logical_or = Net() + output = logical_or(Tensor(x1), Tensor(x2)) + print(x1) + print(x2) + print(output.asnumpy()) + diff --git a/tests/st/ops/davinci/test_tbe_ops/test_matmul.py b/tests/st/ops/ascend/test_tbe_ops/test_matmul.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_matmul.py rename to tests/st/ops/ascend/test_tbe_ops/test_matmul.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_matmul_failed.py b/tests/st/ops/ascend/test_tbe_ops/test_matmul_failed.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_matmul_failed.py rename to tests/st/ops/ascend/test_tbe_ops/test_matmul_failed.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_maximum.py b/tests/st/ops/ascend/test_tbe_ops/test_maximum.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_maximum.py rename to tests/st/ops/ascend/test_tbe_ops/test_maximum.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_maximum_grad.py b/tests/st/ops/ascend/test_tbe_ops/test_maximum_grad.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_maximum_grad.py rename to tests/st/ops/ascend/test_tbe_ops/test_maximum_grad.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_maxpool.py b/tests/st/ops/ascend/test_tbe_ops/test_maxpool.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_maxpool.py rename to tests/st/ops/ascend/test_tbe_ops/test_maxpool.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_maxpool_grad.py b/tests/st/ops/ascend/test_tbe_ops/test_maxpool_grad.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_maxpool_grad.py rename to tests/st/ops/ascend/test_tbe_ops/test_maxpool_grad.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_minimum.py b/tests/st/ops/ascend/test_tbe_ops/test_minimum.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_minimum.py rename to tests/st/ops/ascend/test_tbe_ops/test_minimum.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_minimum_grad.py b/tests/st/ops/ascend/test_tbe_ops/test_minimum_grad.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_minimum_grad.py rename to tests/st/ops/ascend/test_tbe_ops/test_minimum_grad.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_mul.py b/tests/st/ops/ascend/test_tbe_ops/test_mul.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_mul.py rename to tests/st/ops/ascend/test_tbe_ops/test_mul.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_npu_alloc_float_status.py b/tests/st/ops/ascend/test_tbe_ops/test_npu_alloc_float_status.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_npu_alloc_float_status.py rename to tests/st/ops/ascend/test_tbe_ops/test_npu_alloc_float_status.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_npu_clear_float_status.py b/tests/st/ops/ascend/test_tbe_ops/test_npu_clear_float_status.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_npu_clear_float_status.py rename to tests/st/ops/ascend/test_tbe_ops/test_npu_clear_float_status.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_npu_get_float_status.py b/tests/st/ops/ascend/test_tbe_ops/test_npu_get_float_status.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_npu_get_float_status.py rename to tests/st/ops/ascend/test_tbe_ops/test_npu_get_float_status.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_pad.py b/tests/st/ops/ascend/test_tbe_ops/test_pad.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_pad.py rename to tests/st/ops/ascend/test_tbe_ops/test_pad.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_pow.py b/tests/st/ops/ascend/test_tbe_ops/test_pow.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_pow.py rename to tests/st/ops/ascend/test_tbe_ops/test_pow.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_realdiv.py b/tests/st/ops/ascend/test_tbe_ops/test_realdiv.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_realdiv.py rename to tests/st/ops/ascend/test_tbe_ops/test_realdiv.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_reciprocal.py b/tests/st/ops/ascend/test_tbe_ops/test_reciprocal.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_reciprocal.py rename to tests/st/ops/ascend/test_tbe_ops/test_reciprocal.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_relu.py b/tests/st/ops/ascend/test_tbe_ops/test_relu.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_relu.py rename to tests/st/ops/ascend/test_tbe_ops/test_relu.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_relu_grad.py b/tests/st/ops/ascend/test_tbe_ops/test_relu_grad.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_relu_grad.py rename to tests/st/ops/ascend/test_tbe_ops/test_relu_grad.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_resize_nearest_neighbor.py b/tests/st/ops/ascend/test_tbe_ops/test_resize_nearest_neighbor.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_resize_nearest_neighbor.py rename to tests/st/ops/ascend/test_tbe_ops/test_resize_nearest_neighbor.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_resize_nearest_neighbor_grad.py b/tests/st/ops/ascend/test_tbe_ops/test_resize_nearest_neighbor_grad.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_resize_nearest_neighbor_grad.py rename to tests/st/ops/ascend/test_tbe_ops/test_resize_nearest_neighbor_grad.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_scatter_nd.py b/tests/st/ops/ascend/test_tbe_ops/test_scatter_nd.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_scatter_nd.py rename to tests/st/ops/ascend/test_tbe_ops/test_scatter_nd.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_select.py b/tests/st/ops/ascend/test_tbe_ops/test_select.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_select.py rename to tests/st/ops/ascend/test_tbe_ops/test_select.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_sigmoid.py b/tests/st/ops/ascend/test_tbe_ops/test_sigmoid.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_sigmoid.py rename to tests/st/ops/ascend/test_tbe_ops/test_sigmoid.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_sigmoid_cross_entropy_with_logits.py b/tests/st/ops/ascend/test_tbe_ops/test_sigmoid_cross_entropy_with_logits.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_sigmoid_cross_entropy_with_logits.py rename to tests/st/ops/ascend/test_tbe_ops/test_sigmoid_cross_entropy_with_logits.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_sigmoid_cross_entropy_with_logits_grad.py b/tests/st/ops/ascend/test_tbe_ops/test_sigmoid_cross_entropy_with_logits_grad.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_sigmoid_cross_entropy_with_logits_grad.py rename to tests/st/ops/ascend/test_tbe_ops/test_sigmoid_cross_entropy_with_logits_grad.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_sigmoid_grad.py b/tests/st/ops/ascend/test_tbe_ops/test_sigmoid_grad.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_sigmoid_grad.py rename to tests/st/ops/ascend/test_tbe_ops/test_sigmoid_grad.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_slice.py b/tests/st/ops/ascend/test_tbe_ops/test_slice.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_slice.py rename to tests/st/ops/ascend/test_tbe_ops/test_slice.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_smooth_l1_loss.py b/tests/st/ops/ascend/test_tbe_ops/test_smooth_l1_loss.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_smooth_l1_loss.py rename to tests/st/ops/ascend/test_tbe_ops/test_smooth_l1_loss.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_smooth_l1_loss_grad.py b/tests/st/ops/ascend/test_tbe_ops/test_smooth_l1_loss_grad.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_smooth_l1_loss_grad.py rename to tests/st/ops/ascend/test_tbe_ops/test_smooth_l1_loss_grad.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_softmax.py b/tests/st/ops/ascend/test_tbe_ops/test_softmax.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_softmax.py rename to tests/st/ops/ascend/test_tbe_ops/test_softmax.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_softmax_cross_entropy_with_logits.py b/tests/st/ops/ascend/test_tbe_ops/test_softmax_cross_entropy_with_logits.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_softmax_cross_entropy_with_logits.py rename to tests/st/ops/ascend/test_tbe_ops/test_softmax_cross_entropy_with_logits.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_split.py b/tests/st/ops/ascend/test_tbe_ops/test_split.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_split.py rename to tests/st/ops/ascend/test_tbe_ops/test_split.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_sqrt.py b/tests/st/ops/ascend/test_tbe_ops/test_sqrt.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_sqrt.py rename to tests/st/ops/ascend/test_tbe_ops/test_sqrt.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_square.py b/tests/st/ops/ascend/test_tbe_ops/test_square.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_square.py rename to tests/st/ops/ascend/test_tbe_ops/test_square.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_stridedslice.py b/tests/st/ops/ascend/test_tbe_ops/test_stridedslice.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_stridedslice.py rename to tests/st/ops/ascend/test_tbe_ops/test_stridedslice.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_stridedslice_grad.py b/tests/st/ops/ascend/test_tbe_ops/test_stridedslice_grad.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_stridedslice_grad.py rename to tests/st/ops/ascend/test_tbe_ops/test_stridedslice_grad.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_sub.py b/tests/st/ops/ascend/test_tbe_ops/test_sub.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_sub.py rename to tests/st/ops/ascend/test_tbe_ops/test_sub.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_tanh.py b/tests/st/ops/ascend/test_tbe_ops/test_tanh.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_tanh.py rename to tests/st/ops/ascend/test_tbe_ops/test_tanh.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_tanh_grad.py b/tests/st/ops/ascend/test_tbe_ops/test_tanh_grad.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_tanh_grad.py rename to tests/st/ops/ascend/test_tbe_ops/test_tanh_grad.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_tile.py b/tests/st/ops/ascend/test_tbe_ops/test_tile.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_tile.py rename to tests/st/ops/ascend/test_tbe_ops/test_tile.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_topk.py b/tests/st/ops/ascend/test_tbe_ops/test_topk.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_topk.py rename to tests/st/ops/ascend/test_tbe_ops/test_topk.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_transpose_d.py b/tests/st/ops/ascend/test_tbe_ops/test_transpose_d.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_transpose_d.py rename to tests/st/ops/ascend/test_tbe_ops/test_transpose_d.py diff --git a/tests/st/ops/davinci/test_tbe_ops/test_unsorted_segment_sum.py b/tests/st/ops/ascend/test_tbe_ops/test_unsorted_segment_sum.py similarity index 100% rename from tests/st/ops/davinci/test_tbe_ops/test_unsorted_segment_sum.py rename to tests/st/ops/ascend/test_tbe_ops/test_unsorted_segment_sum.py diff --git a/tests/st/ops/davinci/test_tdt_data_ms.py b/tests/st/ops/ascend/test_tdt_data_ms.py similarity index 100% rename from tests/st/ops/davinci/test_tdt_data_ms.py rename to tests/st/ops/ascend/test_tdt_data_ms.py