Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
889d7b6e
M
mindspore
项目概览
magicwindyyd
/
mindspore
与 Fork 源项目一致
Fork自
MindSpore / mindspore
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
mindspore
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
889d7b6e
编写于
5月 15, 2020
作者:
M
mindspore-ci-bot
提交者:
Gitee
5月 15, 2020
浏览文件
操作
浏览文件
下载
差异文件
!1180 [pre_activate]Fix pylint warning
Merge pull request !1180 from YuJianfeng/master
上级
6c8d2920
0f42fdbb
变更
19
隐藏空白更改
内联
并排
Showing
19 changed file
with
122 addition
and
126 deletion
+122
-126
tests/ut/cpp/python_input/gtest_input/pre_activate/__init__.py
.../ut/cpp/python_input/gtest_input/pre_activate/__init__.py
+1
-1
tests/ut/cpp/python_input/gtest_input/pre_activate/batch_norm_grad_split.py
...n_input/gtest_input/pre_activate/batch_norm_grad_split.py
+0
-1
tests/ut/cpp/python_input/gtest_input/pre_activate/bn_grad_split.py
...pp/python_input/gtest_input/pre_activate/bn_grad_split.py
+0
-1
tests/ut/cpp/python_input/gtest_input/pre_activate/buffer_fusion_test.py
...thon_input/gtest_input/pre_activate/buffer_fusion_test.py
+10
-10
tests/ut/cpp/python_input/gtest_input/pre_activate/clip_by_norm_no_div_square_sum_fusion.py
...put/pre_activate/clip_by_norm_no_div_square_sum_fusion.py
+6
-6
tests/ut/cpp/python_input/gtest_input/pre_activate/convert_const_input_test.py
...nput/gtest_input/pre_activate/convert_const_input_test.py
+2
-1
tests/ut/cpp/python_input/gtest_input/pre_activate/convert_tuple_input_to_dynamic_input_test.py
...pre_activate/convert_tuple_input_to_dynamic_input_test.py
+2
-4
tests/ut/cpp/python_input/gtest_input/pre_activate/convert_tuple_output_to_maketuple_test.py
...ut/pre_activate/convert_tuple_output_to_maketuple_test.py
+4
-7
tests/ut/cpp/python_input/gtest_input/pre_activate/eliminate_redundant_op_test.py
...t/gtest_input/pre_activate/eliminate_redundant_op_test.py
+24
-25
tests/ut/cpp/python_input/gtest_input/pre_activate/getnext_memcpy_elimination_test.py
...est_input/pre_activate/getnext_memcpy_elimination_test.py
+8
-8
tests/ut/cpp/python_input/gtest_input/pre_activate/hw_opt_test.py
.../cpp/python_input/gtest_input/pre_activate/hw_opt_test.py
+6
-7
tests/ut/cpp/python_input/gtest_input/pre_activate/lamb_next_mv_rule_test.py
..._input/gtest_input/pre_activate/lamb_next_mv_rule_test.py
+14
-11
tests/ut/cpp/python_input/gtest_input/pre_activate/layer_norm_grad_split.py
...n_input/gtest_input/pre_activate/layer_norm_grad_split.py
+0
-1
tests/ut/cpp/python_input/gtest_input/pre_activate/mixed_precision_test.py
...on_input/gtest_input/pre_activate/mixed_precision_test.py
+12
-13
tests/ut/cpp/python_input/gtest_input/pre_activate/optimize_dependence_test.py
...nput/gtest_input/pre_activate/optimize_dependence_test.py
+8
-8
tests/ut/cpp/python_input/gtest_input/pre_activate/topk_split_test.py
.../python_input/gtest_input/pre_activate/topk_split_test.py
+2
-2
tests/ut/cpp/python_input/gtest_input/pre_activate/transdata_split_test.py
...on_input/gtest_input/pre_activate/transdata_split_test.py
+15
-12
tests/ut/cpp/python_input/gtest_input/pre_activate/transpose_reshape_fusion_test.py
...gtest_input/pre_activate/transpose_reshape_fusion_test.py
+4
-4
tests/ut/cpp/python_input/gtest_input/pre_activate/transpose_transdata_fusion_test.py
...est_input/pre_activate/transpose_transdata_fusion_test.py
+4
-4
未找到文件。
tests/ut/cpp/python_input/gtest_input/pre_activate/__init__.py
浏览文件 @
889d7b6e
...
...
@@ -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
# ============================================================================
tests/ut/cpp/python_input/gtest_input/pre_activate/batch_norm_grad_split.py
浏览文件 @
889d7b6e
...
...
@@ -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
...
...
tests/ut/cpp/python_input/gtest_input/pre_activate/bn_grad_split.py
浏览文件 @
889d7b6e
...
...
@@ -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
...
...
tests/ut/cpp/python_input/gtest_input/pre_activate/buffer_fusion_test.py
浏览文件 @
889d7b6e
...
...
@@ -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
]
tests/ut/cpp/python_input/gtest_input/pre_activate/clip_by_norm_no_div_square_sum_fusion.py
浏览文件 @
889d7b6e
...
...
@@ -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
]
tests/ut/cpp/python_input/gtest_input/pre_activate/convert_const_input_test.py
浏览文件 @
889d7b6e
...
...
@@ -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
):
...
...
tests/ut/cpp/python_input/gtest_input/pre_activate/convert_tuple_input_to_dynamic_input_test.py
浏览文件 @
889d7b6e
...
...
@@ -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
]
tests/ut/cpp/python_input/gtest_input/pre_activate/convert_tuple_output_to_maketuple_test.py
浏览文件 @
889d7b6e
...
...
@@ -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
]
tests/ut/cpp/python_input/gtest_input/pre_activate/eliminate_redundant_op_test.py
浏览文件 @
889d7b6e
...
...
@@ -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
]
tests/ut/cpp/python_input/gtest_input/pre_activate/getnext_memcpy_elimination_test.py
浏览文件 @
889d7b6e
...
...
@@ -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
)
...
...
tests/ut/cpp/python_input/gtest_input/pre_activate/hw_opt_test.py
浏览文件 @
889d7b6e
...
...
@@ -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
]
tests/ut/cpp/python_input/gtest_input/pre_activate/lamb_next_mv_rule_test.py
浏览文件 @
889d7b6e
...
...
@@ -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
)
...
...
tests/ut/cpp/python_input/gtest_input/pre_activate/layer_norm_grad_split.py
浏览文件 @
889d7b6e
...
...
@@ -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
...
...
tests/ut/cpp/python_input/gtest_input/pre_activate/mixed_precision_test.py
浏览文件 @
889d7b6e
...
...
@@ -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
]
tests/ut/cpp/python_input/gtest_input/pre_activate/optimize_dependence_test.py
浏览文件 @
889d7b6e
...
...
@@ -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
]
tests/ut/cpp/python_input/gtest_input/pre_activate/topk_split_test.py
浏览文件 @
889d7b6e
...
...
@@ -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
...
...
tests/ut/cpp/python_input/gtest_input/pre_activate/transdata_split_test.py
浏览文件 @
889d7b6e
...
...
@@ -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
]
tests/ut/cpp/python_input/gtest_input/pre_activate/transpose_reshape_fusion_test.py
浏览文件 @
889d7b6e
...
...
@@ -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
...
...
tests/ut/cpp/python_input/gtest_input/pre_activate/transpose_transdata_fusion_test.py
浏览文件 @
889d7b6e
...
...
@@ -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
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录