diff --git a/tests/ut/cpp/python_input/gtest_input/pre_activate/__init__.py b/tests/ut/cpp/python_input/gtest_input/pre_activate/__init__.py index fc53efd1be..e30774307c 100644 --- a/tests/ut/cpp/python_input/gtest_input/pre_activate/__init__.py +++ b/tests/ut/cpp/python_input/gtest_input/pre_activate/__init__.py @@ -11,4 +11,4 @@ # 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. -# ============================================================================ \ No newline at end of file +# ============================================================================ diff --git a/tests/ut/cpp/python_input/gtest_input/pre_activate/batch_norm_grad_split.py b/tests/ut/cpp/python_input/gtest_input/pre_activate/batch_norm_grad_split.py index dc783f1fbd..afcc1fe292 100644 --- a/tests/ut/cpp/python_input/gtest_input/pre_activate/batch_norm_grad_split.py +++ b/tests/ut/cpp/python_input/gtest_input/pre_activate/batch_norm_grad_split.py @@ -13,7 +13,6 @@ # limitations under the License. # ============================================================================ -from mindspore.ops import operations as P from mindspore.ops.operations import _grad_ops as G from mindspore.ops import Primitive diff --git a/tests/ut/cpp/python_input/gtest_input/pre_activate/bn_grad_split.py b/tests/ut/cpp/python_input/gtest_input/pre_activate/bn_grad_split.py index c26c698260..053a768db6 100644 --- a/tests/ut/cpp/python_input/gtest_input/pre_activate/bn_grad_split.py +++ b/tests/ut/cpp/python_input/gtest_input/pre_activate/bn_grad_split.py @@ -13,7 +13,6 @@ # limitations under the License. # ============================================================================ -from mindspore.ops import operations as P from mindspore.ops.operations import _grad_ops as G from mindspore.ops import Primitive diff --git a/tests/ut/cpp/python_input/gtest_input/pre_activate/buffer_fusion_test.py b/tests/ut/cpp/python_input/gtest_input/pre_activate/buffer_fusion_test.py index 12db1ce97b..bbd72c799f 100644 --- a/tests/ut/cpp/python_input/gtest_input/pre_activate/buffer_fusion_test.py +++ b/tests/ut/cpp/python_input/gtest_input/pre_activate/buffer_fusion_test.py @@ -61,8 +61,8 @@ def test_tbe_eltwise_fusion_1(tag): def after(x): fusion = Fusion_relu_relu(x) res = Cast(fusion) - tuple = make_tuple(res) - return tuple + output = make_tuple(res) + return output return fns[tag] @@ -86,8 +86,8 @@ def test_tbe_eltwise_fusion_2(tag): def after(x, y): fusion = Fusion_biasadd(x, y) res = Cast(fusion) - tuple = make_tuple(res) - return tuple + output = make_tuple(res) + return output return fns[tag] @@ -111,8 +111,8 @@ def test_tbe_reduce_eltwise_fusion(tag): def after(x): fusion = Fusion_biasaddgrad(x) res = Cast(fusion) - tuple = make_tuple(res) - return tuple + output = make_tuple(res) + return output return fns[tag] @@ -131,8 +131,8 @@ def test_conv_singlein_fusion(tag): def after(x, y): fusion = Fusion(x, y) res = Cast(fusion) - tuple = make_tuple(res) - return tuple + output = make_tuple(res) + return output return fns[tag] @@ -151,7 +151,7 @@ def test_tbe_matmul_eltwise_fusion(tag): def after(x, y): fusion = Fusion_matmul_relu(x, y) res = Cast(fusion) - tuple = make_tuple(res) - return tuple + output = make_tuple(res) + return output return fns[tag] diff --git a/tests/ut/cpp/python_input/gtest_input/pre_activate/clip_by_norm_no_div_square_sum_fusion.py b/tests/ut/cpp/python_input/gtest_input/pre_activate/clip_by_norm_no_div_square_sum_fusion.py index 7dd1ba7165..6890cd949c 100644 --- a/tests/ut/cpp/python_input/gtest_input/pre_activate/clip_by_norm_no_div_square_sum_fusion.py +++ b/tests/ut/cpp/python_input/gtest_input/pre_activate/clip_by_norm_no_div_square_sum_fusion.py @@ -40,17 +40,17 @@ def test_clip_by_norm_no_div_square_sum_fusion(tag): fns = FnDict() @fns - def before(input, constant_select, constant_greater, constant_maximum): - greater_output = greater(input, constant_greater) - res = select(greater_output, input, constant_select) + def before(x, constant_select, constant_greater, constant_maximum): + greater_output = greater(x, constant_greater) + res = select(greater_output, x, constant_select) res = sqrt(res) - res = select(greater_output, res, input) + res = select(greater_output, res, x) res = maximum(res, constant_maximum) return res @fns - def after(input, constant_select, constant_greater, constant_maximum): - res = clip_by_norm_no_div_square_sum(input, constant_select, constant_greater, constant_maximum) + def after(x, constant_select, constant_greater, constant_maximum): + res = clip_by_norm_no_div_square_sum(x, constant_select, constant_greater, constant_maximum) return make_tuple(res) return fns[tag] diff --git a/tests/ut/cpp/python_input/gtest_input/pre_activate/convert_const_input_test.py b/tests/ut/cpp/python_input/gtest_input/pre_activate/convert_const_input_test.py index 1ef32eae99..e6da72fdb1 100644 --- a/tests/ut/cpp/python_input/gtest_input/pre_activate/convert_const_input_test.py +++ b/tests/ut/cpp/python_input/gtest_input/pre_activate/convert_const_input_test.py @@ -38,6 +38,7 @@ depth = Tensor(2, mstype.int32) shape = (2, 4, 2, 2) dropout_gen_mask = P.DropoutGenMask() + class FnDict: def __init__(self): self.fnDict = {} @@ -114,7 +115,7 @@ def test_convert_strided_slice_grad_input_to_attr(tag): @fns def before(x): - return stridedslicegrad(x, (16, 128, 1024), (0, 0 , 0), (16, 1, 1024), (1, 1,1)) + return stridedslicegrad(x, (16, 128, 1024), (0, 0, 0), (16, 1, 1024), (1, 1, 1)) @fns def after(x): diff --git a/tests/ut/cpp/python_input/gtest_input/pre_activate/convert_tuple_input_to_dynamic_input_test.py b/tests/ut/cpp/python_input/gtest_input/pre_activate/convert_tuple_input_to_dynamic_input_test.py index 24cfcdd01d..d0190d85a3 100644 --- a/tests/ut/cpp/python_input/gtest_input/pre_activate/convert_tuple_input_to_dynamic_input_test.py +++ b/tests/ut/cpp/python_input/gtest_input/pre_activate/convert_tuple_input_to_dynamic_input_test.py @@ -12,12 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================ +import numpy as np from mindspore.ops import operations as P from mindspore.ops import Primitive -import mindspore as ms -import mindspore.common.dtype as mstype from mindspore.common.tensor import Tensor -import numpy as np make_tuple = Primitive('make_tuple') concat = P.Concat() @@ -51,7 +49,7 @@ def test_convert_tuple_input_to_dynamic_input(tag): def after(x): res = concat(t1, t2) res = add(x, res) - res = make_tuple(res); + res = make_tuple(res) return res return fns[tag] diff --git a/tests/ut/cpp/python_input/gtest_input/pre_activate/convert_tuple_output_to_maketuple_test.py b/tests/ut/cpp/python_input/gtest_input/pre_activate/convert_tuple_output_to_maketuple_test.py index 961f7b6232..c32df513d8 100644 --- a/tests/ut/cpp/python_input/gtest_input/pre_activate/convert_tuple_output_to_maketuple_test.py +++ b/tests/ut/cpp/python_input/gtest_input/pre_activate/convert_tuple_output_to_maketuple_test.py @@ -14,16 +14,13 @@ # ============================================================================ from mindspore.ops import operations as P from mindspore.ops import Primitive -import mindspore as ms -import mindspore.common.dtype as mstype -from mindspore.common.tensor import Tensor -import numpy as np make_tuple = Primitive('make_tuple') -tuple_get_item = Primitive("tuple_getitem"); -LSTM = P.LSTM(input_size=10,hidden_size=2,num_layers=1,has_bias=True,bidirectional=False,dropout=0.0) +tuple_get_item = Primitive("tuple_getitem") +LSTM = P.LSTM(input_size=10, hidden_size=2, num_layers=1, has_bias=True, bidirectional=False, dropout=0.0) add = P.TensorAdd() + class FnDict: def __init__(self): self.fnDict = {} @@ -48,7 +45,7 @@ def test_convert_tuple_output_to_maketuple(tag): res = LSTM(x, h, c, w) res = make_tuple( make_tuple(tuple_get_item(res, 0), tuple_get_item(res, 1), tuple_get_item(res, 2), tuple_get_item(res, 3), - tuple_get_item(res, 4))); + tuple_get_item(res, 4))) return res return fns[tag] diff --git a/tests/ut/cpp/python_input/gtest_input/pre_activate/eliminate_redundant_op_test.py b/tests/ut/cpp/python_input/gtest_input/pre_activate/eliminate_redundant_op_test.py index 652ead2993..961a3ae8a5 100644 --- a/tests/ut/cpp/python_input/gtest_input/pre_activate/eliminate_redundant_op_test.py +++ b/tests/ut/cpp/python_input/gtest_input/pre_activate/eliminate_redundant_op_test.py @@ -40,8 +40,8 @@ def test_eliminate_5to4_4to5(tag): @fns def before(x, y): - sum = add(x, y) - res = sub(sum, y) + sum_add = add(x, y) + res = sub(sum_add, y) output = make_tuple(res) return output @@ -50,8 +50,8 @@ def test_eliminate_5to4_4to5(tag): new_x_sum = transdata(x) new_y_sum = transdata(y) new_y_sum2 = transdata(y) - sum = add(new_x_sum, new_y_sum) - sum_5to4 = transdata(sum) + sum_add = add(new_x_sum, new_y_sum) + sum_5to4 = transdata(sum_add) sum_4to5 = transdata(sum_5to4) res = sub(sum_4to5, new_y_sum2) output = transdata(res) @@ -64,8 +64,8 @@ def test_eliminate_5to4_4to5(tag): new_x_sum = transdata(x) new_y_sum = transdata(y) new_y_diff = transdata(y) - sum = add(new_x_sum, new_y_sum) - res = sub(sum, new_y_diff) + sum_add = add(new_x_sum, new_y_sum) + res = sub(sum_add, new_y_diff) output = transdata(res) new_output = make_tuple(output) ret = make_tuple(new_output) @@ -79,8 +79,8 @@ def test_eliminate_cast(tag): @fns def before(x, y): - sum = add(x, y) - res = sub(sum, y) + sum_add = add(x, y) + res = sub(sum_add, y) output = make_tuple(res) return output @@ -89,8 +89,8 @@ def test_eliminate_cast(tag): new_x_sum = cast(x) new_y_sum = cast(y) new_y_sum2 = cast(y) - sum = add(new_x_sum, new_y_sum) - sum_cast1 = cast(sum) + sum_add = add(new_x_sum, new_y_sum) + sum_cast1 = cast(sum_add) sum_cast2 = cast(sum_cast1) res = sub(sum_cast2, new_y_sum2) output = cast(res) @@ -103,8 +103,8 @@ def test_eliminate_cast(tag): new_x_sum = cast(x) new_y_sum = cast(y) new_y_diff = cast(y) - sum = add(new_x_sum, new_y_sum) - res = sub(sum, new_y_diff) + sum_add = add(new_x_sum, new_y_sum) + res = sub(sum_add, new_y_diff) output = cast(res) new_output = make_tuple(output) ret = make_tuple(new_output) @@ -118,8 +118,8 @@ def test_eliminate_5to4_depend_4to5(tag): @fns def before(x, y): - sum = add(x, y) - sum_depend = depend(sum, x) + sum_add = add(x, y) + sum_depend = depend(sum_add, x) res = sub(sum_depend, y) output = make_tuple(res) return output @@ -128,8 +128,8 @@ def test_eliminate_5to4_depend_4to5(tag): def after1(x, y): new_x_sum = transdata(x) new_y_sum = transdata(y) - sum = add(new_x_sum, new_y_sum) - sum_trans = transdata(sum) + sum_add = add(new_x_sum, new_y_sum) + sum_trans = transdata(sum_add) depend_between_trans = depend(sum_trans, x) depend_trans = transdata(depend_between_trans) new_y_diff = transdata(y) @@ -143,8 +143,8 @@ def test_eliminate_5to4_depend_4to5(tag): def after2(x, y): new_x_sum = transdata(x) new_y_sum = transdata(y) - sum = add(new_x_sum, new_y_sum) - depend_op = depend(sum, x) + sum_add = add(new_x_sum, new_y_sum) + depend_op = depend(sum_add, x) new_y_diff = transdata(y) res = sub(depend_op, new_y_diff) output = transdata(res) @@ -160,8 +160,8 @@ def test_eliminate_cast_depend_cast(tag): @fns def before(x, y): - sum = add(x, y) - sum_depend = depend(sum, x) + sum_add = add(x, y) + sum_depend = depend(sum_add, x) sum_depend2 = depend(sum_depend, x) sum_depend3 = depend(sum_depend2, x) res = sub(sum_depend3, y) @@ -172,8 +172,8 @@ def test_eliminate_cast_depend_cast(tag): def after1(x, y): new_x_sum = cast(x) new_y_sum = cast(y) - sum = add(new_x_sum, new_y_sum) - sum_cast = cast(sum) + sum_add = add(new_x_sum, new_y_sum) + sum_cast = cast(sum_add) depend_between_cast = depend(sum_cast, x) depend_between_cast2 = depend(depend_between_cast, x) depend_between_cast3 = depend(depend_between_cast2, x) @@ -189,8 +189,8 @@ def test_eliminate_cast_depend_cast(tag): def after2(x, y): new_x_sum = cast(x) new_y_sum = cast(y) - sum = add(new_x_sum, new_y_sum) - depend_op = depend(sum, x) + sum_add = add(new_x_sum, new_y_sum) + depend_op = depend(sum_add, x) depend_op2 = depend(depend_op, x) depend_op3 = depend(depend_op2, x) new_y_diff = cast(y) @@ -201,4 +201,3 @@ def test_eliminate_cast_depend_cast(tag): return ret return fns[tag] - diff --git a/tests/ut/cpp/python_input/gtest_input/pre_activate/getnext_memcpy_elimination_test.py b/tests/ut/cpp/python_input/gtest_input/pre_activate/getnext_memcpy_elimination_test.py index 39b60d72d6..e246fbf0ed 100644 --- a/tests/ut/cpp/python_input/gtest_input/pre_activate/getnext_memcpy_elimination_test.py +++ b/tests/ut/cpp/python_input/gtest_input/pre_activate/getnext_memcpy_elimination_test.py @@ -40,14 +40,14 @@ def test_getnext_memcpy_elimination(tag): fns = FnDict() @fns - def before(x): + def before(): res = get_next() res = memcpy_async_attr(res) res = cast(res) return res @fns - def after(x): + def after(): res = get_next() res = cast(res) return res @@ -59,14 +59,14 @@ def test_getnext_memcpy_elimination_no_attr(tag): fns = FnDict() @fns - def before(x): + def before(): res = get_next() res = memcpy_async(res) res = cast(res) return res @fns - def after(x): + def after(): res = get_next() res = memcpy_async(res) res = cast(res) @@ -79,7 +79,7 @@ def test_getnext_memcpy_elimination_memcpy_multi_users(tag): fns = FnDict() @fns - def before(x): + def before(): res = get_next() memcpy_out = memcpy_async_attr(res) res = cast(memcpy_out) @@ -87,7 +87,7 @@ def test_getnext_memcpy_elimination_memcpy_multi_users(tag): return res @fns - def after(x): + def after(): res = get_next() memcpy_out = memcpy_async_attr(res) res = cast(memcpy_out) @@ -101,14 +101,14 @@ def test_getnext_memcpy_elimination_next_multi_inputs(tag): fns = FnDict() @fns - def before(x): + def before(): res = get_next() memcpy_out = memcpy_async_attr(res) res = add(memcpy_out, res) return res @fns - def after(x): + def after(): res = get_next() memcpy_out = memcpy_async_attr(res) res = add(memcpy_out, res) diff --git a/tests/ut/cpp/python_input/gtest_input/pre_activate/hw_opt_test.py b/tests/ut/cpp/python_input/gtest_input/pre_activate/hw_opt_test.py index 2877bc7c7a..977382e317 100644 --- a/tests/ut/cpp/python_input/gtest_input/pre_activate/hw_opt_test.py +++ b/tests/ut/cpp/python_input/gtest_input/pre_activate/hw_opt_test.py @@ -127,14 +127,14 @@ def test_eliminate_depend_input2(tag): def before(x, y, z): new_z = four2five(z) depend_intput = depend(y, new_z) - sum = add(x, depend_intput) - return sum + sum_add = add(x, depend_intput) + return sum_add @fns def after(x, y, z): depend_intput = depend(y, z) - sum = add(x, depend_intput) - return sum + sum_add = add(x, depend_intput) + return sum_add return fns[tag] @@ -144,8 +144,8 @@ def test_opt_match(tag): @fns def graph1(x, y): - sum = add(x, y) - output = make_tuple(sum) + sum_add = add(x, y) + output = make_tuple(sum_add) return output @fns @@ -178,4 +178,3 @@ def test_func_graph_cse(tag): return d return fns[tag] - diff --git a/tests/ut/cpp/python_input/gtest_input/pre_activate/lamb_next_mv_rule_test.py b/tests/ut/cpp/python_input/gtest_input/pre_activate/lamb_next_mv_rule_test.py index 6690408b08..3daaa3f4fb 100644 --- a/tests/ut/cpp/python_input/gtest_input/pre_activate/lamb_next_mv_rule_test.py +++ b/tests/ut/cpp/python_input/gtest_input/pre_activate/lamb_next_mv_rule_test.py @@ -66,17 +66,17 @@ def test_lamb_next_mv_rule(tag): def after(input0, input1, input2, input3, input4, input5, input6, constant_mul0_x, constant_mul1_sub, constant_mul2_x, constant_mul3_sub1, constant_mul4_x, constant_add2_y): lamb_next_mv = LambNextMV(input0, input1, input2, input3, input4, input5, input6, - constant_mul0_x, constant_mul1_sub, - constant_mul2_x, constant_mul3_sub1, constant_mul4_x, - constant_add2_y) + constant_mul0_x, constant_mul1_sub, constant_mul2_x, constant_mul3_sub1, + constant_mul4_x, constant_add2_y) outputs = make_tuple(tuple_getitem(lamb_next_mv, 0), tuple_getitem(lamb_next_mv, 1), tuple_getitem(lamb_next_mv, 2), tuple_getitem(lamb_next_mv, 3)) output = tuple_getitem(outputs, 0) return make_tuple(output) @fns - def before_unmatched_real_div4(input0, input1, input2, input3, input4, input5, input6, constant_mul0_x, constant_mul1_sub, - constant_mul2_x, constant_mul3_sub1, constant_mul4_x, constant_add2_y): + def before_unmatched_real_div4(input0, input1, input2, input3, input4, input5, input6, constant_mul0_x, + constant_mul1_sub, constant_mul2_x, constant_mul3_sub1, constant_mul4_x, + constant_add2_y): mul0 = Mul(constant_mul0_x, input4) mul1 = Mul(constant_mul1_sub, input3) add0 = Add(mul0, mul1) @@ -98,8 +98,9 @@ def test_lamb_next_mv_rule(tag): return output @fns - def before_unmatched_real_div0(input0, input1, input2, input3, input4, input5, input6, constant_mul0_x, constant_mul1_sub, - constant_mul2_x, constant_mul3_sub1, constant_mul4_x, constant_add2_y): + def before_unmatched_real_div0(input0, input1, input2, input3, input4, input5, input6, constant_mul0_x, + constant_mul1_sub, constant_mul2_x, constant_mul3_sub1, constant_mul4_x, + constant_add2_y): mul0 = Mul(constant_mul0_x, input4) mul1 = Mul(constant_mul1_sub, input3) add0 = Add(mul0, mul1) @@ -121,8 +122,9 @@ def test_lamb_next_mv_rule(tag): return output @fns - def before_unmatched_real_div1(input0, input1, input2, input3, input4, input5, input6, constant_mul0_x, constant_mul1_sub, - constant_mul2_x, constant_mul3_sub1, constant_mul4_x, constant_add2_y): + def before_unmatched_real_div1(input0, input1, input2, input3, input4, input5, input6, constant_mul0_x, + constant_mul1_sub, constant_mul2_x, constant_mul3_sub1, constant_mul4_x, + constant_add2_y): mul0 = Mul(constant_mul0_x, input4) mul1 = Mul(constant_mul1_sub, input3) add0 = Add(mul0, mul1) @@ -144,8 +146,9 @@ def test_lamb_next_mv_rule(tag): return output @fns - def before_unmatched_real_div2(input0, input1, input2, input3, input4, input5, input6, constant_mul0_x, constant_mul1_sub, - constant_mul2_x, constant_mul3_sub1, constant_mul4_x, constant_add2_y): + def before_unmatched_real_div2(input0, input1, input2, input3, input4, input5, input6, constant_mul0_x, + constant_mul1_sub, constant_mul2_x, constant_mul3_sub1, constant_mul4_x, + constant_add2_y): mul0 = Mul(constant_mul0_x, input4) mul1 = Mul(constant_mul1_sub, input3) add0 = Add(mul0, mul1) diff --git a/tests/ut/cpp/python_input/gtest_input/pre_activate/layer_norm_grad_split.py b/tests/ut/cpp/python_input/gtest_input/pre_activate/layer_norm_grad_split.py index 930c76a8f5..faf31d11fc 100644 --- a/tests/ut/cpp/python_input/gtest_input/pre_activate/layer_norm_grad_split.py +++ b/tests/ut/cpp/python_input/gtest_input/pre_activate/layer_norm_grad_split.py @@ -13,7 +13,6 @@ # limitations under the License. # ============================================================================ -from mindspore.ops import operations as P from mindspore.ops.operations import _grad_ops as G from mindspore.ops import Primitive diff --git a/tests/ut/cpp/python_input/gtest_input/pre_activate/mixed_precision_test.py b/tests/ut/cpp/python_input/gtest_input/pre_activate/mixed_precision_test.py index 7d3985376b..7069cca1e0 100644 --- a/tests/ut/cpp/python_input/gtest_input/pre_activate/mixed_precision_test.py +++ b/tests/ut/cpp/python_input/gtest_input/pre_activate/mixed_precision_test.py @@ -82,8 +82,8 @@ def test_eliminate_cast_op(tag): @fns def before(x, y): - sum = addn((x, y)) - sum_depend = depend(sum, addn((x, y))) + sum_add = addn((x, y)) + sum_depend = depend(sum_add, addn((x, y))) diff = sub(x, y) res = mul(sum_depend, diff) return res @@ -92,8 +92,8 @@ def test_eliminate_cast_op(tag): def after1(x, y): new_x_sum = cast(x) new_y_sum = cast(y) - sum = addn(new_x_sum, new_y_sum) - sum_cast = cast(sum) + sum_add = addn(new_x_sum, new_y_sum) + sum_cast = cast(sum_add) new_x_depend = cast(x) new_y_depend = cast(y) sum_depend = addn(new_x_depend, new_y_depend) @@ -114,12 +114,12 @@ def test_eliminate_cast_op(tag): def after2(x, y): new_x_sum = cast(x) new_y_sum = cast(y) - sum = addn(new_x_sum, new_y_sum) + sum_add = addn(new_x_sum, new_y_sum) new_x_depend = cast(x) new_y_depend = cast(y) sum_depend = addn(new_x_depend, new_y_depend) sum_depend_cast = cast(sum_depend) - depend_between_cast = depend(sum, sum_depend_cast) + depend_between_cast = depend(sum_add, sum_depend_cast) new_x_diff = cast(x) new_y_diff = cast(y) diff = sub(new_x_diff, new_y_diff) @@ -156,8 +156,8 @@ def test_eliminate_cast_new(tag): @fns def before(x, y): - sum = add(x, y) - res = sub(sum, y) + sum_add = add(x, y) + res = sub(sum_add, y) output = make_tuple(res) return output @@ -166,8 +166,8 @@ def test_eliminate_cast_new(tag): new_x_sum = cast(x) new_y_sum = cast(y) new_y_sum2 = cast(y) - sum = add(new_x_sum, new_y_sum) - sum_5to4 = cast(sum) + sum_add = add(new_x_sum, new_y_sum) + sum_5to4 = cast(sum_add) sum_4to5 = cast(sum_5to4) res = sub(sum_4to5, new_y_sum2) output = cast(res) @@ -179,11 +179,10 @@ def test_eliminate_cast_new(tag): new_x_sum = cast(x) new_y_sum = cast(y) new_y_diff = cast(y) - sum = add(new_x_sum, new_y_sum) - res = sub(sum, new_y_diff) + sum_add = add(new_x_sum, new_y_sum) + res = sub(sum_add, new_y_diff) output = cast(res) new_output = make_tuple(output) return new_output return fns[tag] - diff --git a/tests/ut/cpp/python_input/gtest_input/pre_activate/optimize_dependence_test.py b/tests/ut/cpp/python_input/gtest_input/pre_activate/optimize_dependence_test.py index 05eb057327..663b17afbf 100644 --- a/tests/ut/cpp/python_input/gtest_input/pre_activate/optimize_dependence_test.py +++ b/tests/ut/cpp/python_input/gtest_input/pre_activate/optimize_dependence_test.py @@ -39,14 +39,14 @@ def test_optimize_dependence(tag): def before(x, y, z): new_z = TransData(z) depend_intput = depend(y, new_z) - sum = add(x, depend_intput) - return sum + sum_add = add(x, depend_intput) + return sum_add @fns def after(x, y, z): depend_intput = depend(y, z) - sum = add(x, depend_intput) - return sum + sum_add = add(x, depend_intput) + return sum_add return fns[tag] @@ -58,14 +58,14 @@ def test_optimize_dependence_with_make_tuple(tag): def before(x, y, a, b): z = make_tuple(TransData(a), TransData(b)) depend_intput = depend(y, z) - sum = add(x, depend_intput) - return sum + sum_add = add(x, depend_intput) + return sum_add @fns def after(x, y, a, b): z = make_tuple(a, b) depend_intput = depend(y, z) - sum = add(x, depend_intput) - return sum + sum_add = add(x, depend_intput) + return sum_add return fns[tag] diff --git a/tests/ut/cpp/python_input/gtest_input/pre_activate/topk_split_test.py b/tests/ut/cpp/python_input/gtest_input/pre_activate/topk_split_test.py index c173419897..b955c2bf11 100644 --- a/tests/ut/cpp/python_input/gtest_input/pre_activate/topk_split_test.py +++ b/tests/ut/cpp/python_input/gtest_input/pre_activate/topk_split_test.py @@ -34,8 +34,8 @@ def test_topk_split(tag): fns = FnDict() @fns - def before(input): - topk = TopK(input, 2) + def before(x): + topk = TopK(x, 2) output = tuple_getitem(topk, 0) return output diff --git a/tests/ut/cpp/python_input/gtest_input/pre_activate/transdata_split_test.py b/tests/ut/cpp/python_input/gtest_input/pre_activate/transdata_split_test.py index e353cf8fbe..30e8015259 100644 --- a/tests/ut/cpp/python_input/gtest_input/pre_activate/transdata_split_test.py +++ b/tests/ut/cpp/python_input/gtest_input/pre_activate/transdata_split_test.py @@ -22,9 +22,10 @@ make_tuple = Primitive('make_tuple') four2five = Primitive('Four2Five') five2four = Primitive('Five2Four') transdata = Primitive("TransData") -transpose = Primitive("Transpose") +transpose = Primitive("Transpose") Transpose = P.Transpose() + class FnDict: def __init__(self): self.fnDict = {} @@ -40,33 +41,35 @@ def test_transdata_split_fraz_nchw(tag): fns = FnDict() @fns - def before(input): - res = Transpose(input, (1, 0, 2, 3)) + def before(x): + res = Transpose(x, (1, 0, 2, 3)) return res @fns - def after(input): - res = transpose(input) - output = transdata(res) + def after(x): + res = transpose(x) + output = transdata(res) output = transpose(output) res = make_tuple(output) return res return fns[tag] + + def test_transdata_split_nchw_fraz(tag): fns = FnDict() @fns - def before(input): - res = Transpose(input, (1, 0, 2, 3)) + def before(x): + res = Transpose(x, (1, 0, 2, 3)) return res @fns - def after(input): - res = transpose(input) - output = transdata(res) + def after(x): + res = transpose(x) + output = transdata(res) output = transpose(output) res = make_tuple(output) return res - return fns[tag] \ No newline at end of file + return fns[tag] diff --git a/tests/ut/cpp/python_input/gtest_input/pre_activate/transpose_reshape_fusion_test.py b/tests/ut/cpp/python_input/gtest_input/pre_activate/transpose_reshape_fusion_test.py index 01e253fb8b..f1bc5f20fd 100644 --- a/tests/ut/cpp/python_input/gtest_input/pre_activate/transpose_reshape_fusion_test.py +++ b/tests/ut/cpp/python_input/gtest_input/pre_activate/transpose_reshape_fusion_test.py @@ -35,14 +35,14 @@ def test_transpose_reshape_fusion(tag): fns = FnDict() @fns - def before(input): - transpose = Transpose(input, (1, 0, 2, 3)) + def before(x): + transpose = Transpose(x, (1, 0, 2, 3)) reshape = Reshape(transpose, (2, 4, 8, 16)) return reshape @fns - def after(input): - confusion = ConfusionTransposeD(input) + def after(x): + confusion = ConfusionTransposeD(x) res = make_tuple(confusion) return res diff --git a/tests/ut/cpp/python_input/gtest_input/pre_activate/transpose_transdata_fusion_test.py b/tests/ut/cpp/python_input/gtest_input/pre_activate/transpose_transdata_fusion_test.py index c4fc50e0da..657e2938cb 100644 --- a/tests/ut/cpp/python_input/gtest_input/pre_activate/transpose_transdata_fusion_test.py +++ b/tests/ut/cpp/python_input/gtest_input/pre_activate/transpose_transdata_fusion_test.py @@ -37,13 +37,13 @@ def test_transpose_transdata_fusion(tag): fns = FnDict() @fns - def before(input): - res = Transpose(input, (1, 0, 2, 3)) + def before(x): + res = Transpose(x, (1, 0, 2, 3)) return res @fns - def after(input): - output = transdata(input) + def after(x): + output = transdata(x) res = make_tuple(output) return res