Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
df6c74c3
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2299
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
df6c74c3
编写于
7月 04, 2023
作者:
C
cyberslack_lee
提交者:
GitHub
7月 04, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[CodeStyle][CINN] fix Ruff lint errors (flake8-comprehensions rules) (#55087)
上级
2265d7bc
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
34 addition
and
41 deletion
+34
-41
pyproject.toml
pyproject.toml
+1
-3
test/cinn/fusion/fusion_test.py
test/cinn/fusion/fusion_test.py
+1
-1
test/cinn/op_mappers/op_mapper_test.py
test/cinn/op_mappers/op_mapper_test.py
+13
-13
test/cinn/op_mappers/test_fill_constant_op.py
test/cinn/op_mappers/test_fill_constant_op.py
+2
-2
test/cinn/op_mappers/test_gaussian_random_op.py
test/cinn/op_mappers/test_gaussian_random_op.py
+3
-3
test/cinn/op_mappers/test_randint_op.py
test/cinn/op_mappers/test_randint_op.py
+3
-3
test/cinn/op_mappers/test_uniform_random_op.py
test/cinn/op_mappers/test_uniform_random_op.py
+3
-3
test/cinn/ops/test_clz_op.py
test/cinn/ops/test_clz_op.py
+1
-6
test/cinn/ops/test_matmul_op.py
test/cinn/ops/test_matmul_op.py
+1
-1
test/cinn/ops/test_popc_op.py
test/cinn/ops/test_popc_op.py
+1
-1
test/cinn/passes/pass_test.py
test/cinn/passes/pass_test.py
+2
-2
test/cinn/test_paddle_model_convertor.py
test/cinn/test_paddle_model_convertor.py
+2
-2
tools/cinn/gen_c++_tutorial.py
tools/cinn/gen_c++_tutorial.py
+1
-1
未找到文件。
pyproject.toml
浏览文件 @
df6c74c3
...
@@ -107,14 +107,12 @@ ignore = [
...
@@ -107,14 +107,12 @@ ignore = [
"F403"
,
"F403"
,
"F632"
,
"F632"
,
"F811"
,
"F811"
,
"C408"
,
"C417"
,
"PLR0402"
,
"PLR0402"
,
"PLC0414"
,
"PLC0414"
,
"PLE1205"
,
"PLE1205"
,
]
]
"tools/cinn/**"
=
[
"tools/cinn/**"
=
[
"F401"
,
"F401"
,
"C416"
,
"PLR0402"
,
"PLR0402"
,
]
]
test/cinn/fusion/fusion_test.py
浏览文件 @
df6c74c3
...
@@ -26,7 +26,7 @@ class FusionTest(PassTest):
...
@@ -26,7 +26,7 @@ class FusionTest(PassTest):
def
init_input_data
(
self
):
def
init_input_data
(
self
):
"""Set feed data"""
"""Set feed data"""
self
.
feed_data
=
dict
()
self
.
feed_data
=
{}
logger
.
warn
(
"No Input Data"
)
logger
.
warn
(
"No Input Data"
)
def
build_program
(
self
,
builder
,
target
):
def
build_program
(
self
,
builder
,
target
):
...
...
test/cinn/op_mappers/op_mapper_test.py
浏览文件 @
df6c74c3
...
@@ -77,7 +77,7 @@ class OpMapperTest(OpTest):
...
@@ -77,7 +77,7 @@ class OpMapperTest(OpTest):
x2 = paddle.static.data(name='x2', shape=[1, 2], dtype='float32')
x2 = paddle.static.data(name='x2', shape=[1, 2], dtype='float32')
return {'X' : [x1, x2]}
return {'X' : [x1, x2]}
```"""
```"""
return
dict
()
return
{}
def
set_op_attrs
(
self
)
->
dict
:
def
set_op_attrs
(
self
)
->
dict
:
"""Map from attribute name to attribute value:
\n
"""Map from attribute name to attribute value:
\n
...
@@ -86,7 +86,7 @@ class OpMapperTest(OpTest):
...
@@ -86,7 +86,7 @@ class OpMapperTest(OpTest):
return {'axis' : 0}
return {'axis' : 0}
```
```
"""
"""
return
dict
()
return
{}
def
set_op_outputs
(
self
)
->
dict
:
def
set_op_outputs
(
self
)
->
dict
:
"""Map from output parameter name to argument type, the argument type should be represented by a string.
\n
"""Map from output parameter name to argument type, the argument type should be represented by a string.
\n
...
@@ -113,7 +113,7 @@ class OpMapperTest(OpTest):
...
@@ -113,7 +113,7 @@ class OpMapperTest(OpTest):
return {'MeanOut' : 'Mean'}
return {'MeanOut' : 'Mean'}
```
```
"""
"""
return
dict
()
return
{}
def
__set_paddle_op
(
self
):
def
__set_paddle_op
(
self
):
# paddle C++ op type
# paddle C++ op type
...
@@ -130,8 +130,8 @@ class OpMapperTest(OpTest):
...
@@ -130,8 +130,8 @@ class OpMapperTest(OpTest):
self
.
inplace_outputs
=
self
.
set_inplace_outputs
()
self
.
inplace_outputs
=
self
.
set_inplace_outputs
()
# collect some important infomation
# collect some important infomation
self
.
input_arg_map
=
self
.
__get_arguments_map
(
self
.
inputs
)
self
.
input_arg_map
=
self
.
__get_arguments_map
(
self
.
inputs
)
self
.
fetch_targets
=
list
()
self
.
fetch_targets
=
[]
self
.
skip_check_list
=
list
()
self
.
skip_check_list
=
[]
self
.
op_desc
=
None
self
.
op_desc
=
None
def
__check_valid
(
self
):
def
__check_valid
(
self
):
...
@@ -194,7 +194,7 @@ class OpMapperTest(OpTest):
...
@@ -194,7 +194,7 @@ class OpMapperTest(OpTest):
)
)
def
__get_arguments_map
(
self
,
param_maps
):
def
__get_arguments_map
(
self
,
param_maps
):
arg_maps
=
dict
()
arg_maps
=
{}
for
args
in
param_maps
.
values
():
for
args
in
param_maps
.
values
():
self
.
assertIsInstance
(
self
.
assertIsInstance
(
args
,
args
,
...
@@ -219,7 +219,7 @@ class OpMapperTest(OpTest):
...
@@ -219,7 +219,7 @@ class OpMapperTest(OpTest):
self
.
__check_valid
()
self
.
__check_valid
()
def
__remove_skip_outputs
(
self
,
results
):
def
__remove_skip_outputs
(
self
,
results
):
check_outputs
=
list
()
check_outputs
=
[]
for
i
in
range
(
len
(
self
.
fetch_targets
)):
for
i
in
range
(
len
(
self
.
fetch_targets
)):
if
self
.
fetch_targets
[
i
].
name
not
in
self
.
skip_check_list
:
if
self
.
fetch_targets
[
i
].
name
not
in
self
.
skip_check_list
:
check_outputs
.
append
(
results
[
i
])
check_outputs
.
append
(
results
[
i
])
...
@@ -259,14 +259,14 @@ class OpMapperTest(OpTest):
...
@@ -259,14 +259,14 @@ class OpMapperTest(OpTest):
self
.
__init_paddle_op
()
self
.
__init_paddle_op
()
helper
=
LayerHelper
(
self
.
op_type
)
helper
=
LayerHelper
(
self
.
op_type
)
self
.
outputs
=
dict
()
self
.
outputs
=
{}
for
var_name
,
dtypes
in
self
.
output_dtypes
.
items
():
for
var_name
,
dtypes
in
self
.
output_dtypes
.
items
():
self
.
assertIsInstance
(
self
.
assertIsInstance
(
dtypes
,
dtypes
,
list
,
list
,
msg
=
"The set_op_outputs should be return dict(OutName, list(OutDtype)), where OutName and OutDtype are string"
,
msg
=
"The set_op_outputs should be return dict(OutName, list(OutDtype)), where OutName and OutDtype are string"
,
)
)
self
.
outputs
[
var_name
]
=
list
()
self
.
outputs
[
var_name
]
=
[]
for
dtype
in
dtypes
:
for
dtype
in
dtypes
:
out_var
=
helper
.
create_variable_for_type_inference
(
dtype
)
out_var
=
helper
.
create_variable_for_type_inference
(
dtype
)
self
.
fetch_targets
.
append
(
out_var
)
self
.
fetch_targets
.
append
(
out_var
)
...
@@ -356,7 +356,7 @@ class OpMapperTest(OpTest):
...
@@ -356,7 +356,7 @@ class OpMapperTest(OpTest):
cinn_feed_datas
.
append
(
self
.
feed_data
[
name
])
cinn_feed_datas
.
append
(
self
.
feed_data
[
name
])
# get the CINN output list
# get the CINN output list
fetch_names
=
list
()
fetch_names
=
[]
inplace_start
=
0
inplace_start
=
0
for
dtypes
in
self
.
output_dtypes
.
values
():
for
dtypes
in
self
.
output_dtypes
.
values
():
inplace_start
+=
len
(
dtypes
)
inplace_start
+=
len
(
dtypes
)
...
@@ -374,7 +374,7 @@ class OpMapperTest(OpTest):
...
@@ -374,7 +374,7 @@ class OpMapperTest(OpTest):
self
.
assertGreater
(
self
.
assertGreater
(
len
(
fetch_names
),
0
,
msg
=
"The program's output cannot be empty!"
len
(
fetch_names
),
0
,
msg
=
"The program's output cannot be empty!"
)
)
cinn_output_vars
=
list
()
cinn_output_vars
=
[]
for
name
in
fetch_names
:
for
name
in
fetch_names
:
cinn_name
=
convertor
.
get_cinn_name
(
name
)
cinn_name
=
convertor
.
get_cinn_name
(
name
)
...
@@ -394,7 +394,7 @@ class OpMapperTest(OpTest):
...
@@ -394,7 +394,7 @@ class OpMapperTest(OpTest):
cinn_inputs
,
cinn_inputs
,
cinn_feed_datas
,
cinn_feed_datas
,
cinn_output_vars
,
cinn_output_vars
,
passes
=
list
()
,
passes
=
[]
,
scope
=
scope
,
scope
=
scope
,
)
)
...
@@ -403,7 +403,7 @@ class OpMapperTest(OpTest):
...
@@ -403,7 +403,7 @@ class OpMapperTest(OpTest):
@
staticmethod
@
staticmethod
def
get_program_vars
(
program
)
->
dict
:
def
get_program_vars
(
program
)
->
dict
:
vars
=
dict
()
vars
=
{}
for
i
in
range
(
program
.
size
()):
for
i
in
range
(
program
.
size
()):
instr
=
program
[
i
]
instr
=
program
[
i
]
for
var
in
instr
.
get_inputs
():
for
var
in
instr
.
get_inputs
():
...
...
test/cinn/op_mappers/test_fill_constant_op.py
浏览文件 @
df6c74c3
...
@@ -53,7 +53,7 @@ class TestFillConstantOp(OpMapperTest):
...
@@ -53,7 +53,7 @@ class TestFillConstantOp(OpMapperTest):
class
TestFillConstantCase1
(
TestFillConstantOp
):
class
TestFillConstantCase1
(
TestFillConstantOp
):
def
init_input_data
(
self
):
def
init_input_data
(
self
):
self
.
feed_data
=
dict
()
self
.
feed_data
=
{}
self
.
shape
=
[
10
,
10
]
self
.
shape
=
[
10
,
10
]
self
.
value
=
np
.
random
.
default_rng
(
12345
).
integers
(
low
=
0
,
high
=
10000
)
self
.
value
=
np
.
random
.
default_rng
(
12345
).
integers
(
low
=
0
,
high
=
10000
)
self
.
str_value
=
""
self
.
str_value
=
""
...
@@ -62,7 +62,7 @@ class TestFillConstantCase1(TestFillConstantOp):
...
@@ -62,7 +62,7 @@ class TestFillConstantCase1(TestFillConstantOp):
class
TestFillConstantCase2
(
TestFillConstantOp
):
class
TestFillConstantCase2
(
TestFillConstantOp
):
def
init_input_data
(
self
):
def
init_input_data
(
self
):
self
.
feed_data
=
dict
()
self
.
feed_data
=
{}
self
.
shape
=
[
10
,
10
]
self
.
shape
=
[
10
,
10
]
self
.
value
=
0
self
.
value
=
0
self
.
str_value
=
"0.123456"
self
.
str_value
=
"0.123456"
...
...
test/cinn/op_mappers/test_gaussian_random_op.py
浏览文件 @
df6c74c3
...
@@ -24,7 +24,7 @@ import paddle
...
@@ -24,7 +24,7 @@ import paddle
class
TestGaussianRandomOp
(
OpMapperTest
):
class
TestGaussianRandomOp
(
OpMapperTest
):
def
init_input_data
(
self
):
def
init_input_data
(
self
):
self
.
feed_data
=
dict
()
self
.
feed_data
=
{}
self
.
shape
=
[
2
,
3
]
self
.
shape
=
[
2
,
3
]
self
.
mean
=
0.0
self
.
mean
=
0.0
self
.
std
=
1.0
self
.
std
=
1.0
...
@@ -59,7 +59,7 @@ class TestGaussianRandomOp(OpMapperTest):
...
@@ -59,7 +59,7 @@ class TestGaussianRandomOp(OpMapperTest):
class
TestGaussianRandomCase1
(
TestGaussianRandomOp
):
class
TestGaussianRandomCase1
(
TestGaussianRandomOp
):
def
init_input_data
(
self
):
def
init_input_data
(
self
):
self
.
feed_data
=
dict
()
self
.
feed_data
=
{}
self
.
shape
=
[
2
,
3
,
4
]
self
.
shape
=
[
2
,
3
,
4
]
self
.
mean
=
1.0
self
.
mean
=
1.0
self
.
std
=
2.0
self
.
std
=
2.0
...
@@ -69,7 +69,7 @@ class TestGaussianRandomCase1(TestGaussianRandomOp):
...
@@ -69,7 +69,7 @@ class TestGaussianRandomCase1(TestGaussianRandomOp):
class
TestGaussianRandomCase2
(
TestGaussianRandomOp
):
class
TestGaussianRandomCase2
(
TestGaussianRandomOp
):
def
init_input_data
(
self
):
def
init_input_data
(
self
):
self
.
feed_data
=
dict
()
self
.
feed_data
=
{}
self
.
shape
=
[
2
,
3
,
4
]
self
.
shape
=
[
2
,
3
,
4
]
self
.
mean
=
2.0
self
.
mean
=
2.0
self
.
std
=
3.0
self
.
std
=
3.0
...
...
test/cinn/op_mappers/test_randint_op.py
浏览文件 @
df6c74c3
...
@@ -24,7 +24,7 @@ import paddle
...
@@ -24,7 +24,7 @@ import paddle
class
TestRandIntOp
(
OpMapperTest
):
class
TestRandIntOp
(
OpMapperTest
):
def
init_input_data
(
self
):
def
init_input_data
(
self
):
self
.
feed_data
=
dict
()
self
.
feed_data
=
{}
self
.
shape
=
[
2
,
3
]
self
.
shape
=
[
2
,
3
]
self
.
min
=
1
self
.
min
=
1
self
.
max
=
5
self
.
max
=
5
...
@@ -61,7 +61,7 @@ class TestRandIntOp(OpMapperTest):
...
@@ -61,7 +61,7 @@ class TestRandIntOp(OpMapperTest):
class
TestRandIntCase1
(
TestRandIntOp
):
class
TestRandIntCase1
(
TestRandIntOp
):
def
init_input_data
(
self
):
def
init_input_data
(
self
):
self
.
feed_data
=
dict
()
self
.
feed_data
=
{}
self
.
shape
=
[
2
,
3
,
4
]
self
.
shape
=
[
2
,
3
,
4
]
self
.
min
=
1
self
.
min
=
1
self
.
max
=
9
self
.
max
=
9
...
@@ -71,7 +71,7 @@ class TestRandIntCase1(TestRandIntOp):
...
@@ -71,7 +71,7 @@ class TestRandIntCase1(TestRandIntOp):
class
TestRandIntCase2
(
TestRandIntOp
):
class
TestRandIntCase2
(
TestRandIntOp
):
def
init_input_data
(
self
):
def
init_input_data
(
self
):
self
.
feed_data
=
dict
()
self
.
feed_data
=
{}
self
.
shape
=
[
2
,
3
,
4
]
self
.
shape
=
[
2
,
3
,
4
]
self
.
min
=
1
self
.
min
=
1
self
.
max
=
9
self
.
max
=
9
...
...
test/cinn/op_mappers/test_uniform_random_op.py
浏览文件 @
df6c74c3
...
@@ -24,7 +24,7 @@ import paddle
...
@@ -24,7 +24,7 @@ import paddle
class
TestUniformRandomOp
(
OpMapperTest
):
class
TestUniformRandomOp
(
OpMapperTest
):
def
init_input_data
(
self
):
def
init_input_data
(
self
):
self
.
feed_data
=
dict
()
self
.
feed_data
=
{}
self
.
shape
=
[
2
,
3
]
self
.
shape
=
[
2
,
3
]
self
.
min
=
-
1.0
self
.
min
=
-
1.0
self
.
max
=
1.0
self
.
max
=
1.0
...
@@ -65,7 +65,7 @@ class TestUniformRandomOp(OpMapperTest):
...
@@ -65,7 +65,7 @@ class TestUniformRandomOp(OpMapperTest):
class
TestUniformRandomCase1
(
TestUniformRandomOp
):
class
TestUniformRandomCase1
(
TestUniformRandomOp
):
def
init_input_data
(
self
):
def
init_input_data
(
self
):
self
.
feed_data
=
dict
()
self
.
feed_data
=
{}
self
.
shape
=
[
2
,
3
,
4
]
self
.
shape
=
[
2
,
3
,
4
]
self
.
min
=
-
5.5
self
.
min
=
-
5.5
self
.
max
=
5.5
self
.
max
=
5.5
...
@@ -78,7 +78,7 @@ class TestUniformRandomCase1(TestUniformRandomOp):
...
@@ -78,7 +78,7 @@ class TestUniformRandomCase1(TestUniformRandomOp):
class
TestUniformRandomCase2
(
TestUniformRandomOp
):
class
TestUniformRandomCase2
(
TestUniformRandomOp
):
def
init_input_data
(
self
):
def
init_input_data
(
self
):
self
.
feed_data
=
dict
()
self
.
feed_data
=
{}
self
.
shape
=
[
2
,
3
,
4
]
self
.
shape
=
[
2
,
3
,
4
]
self
.
min
=
-
10.0
self
.
min
=
-
10.0
self
.
max
=
10.0
self
.
max
=
10.0
...
...
test/cinn/ops/test_clz_op.py
浏览文件 @
df6c74c3
...
@@ -60,12 +60,7 @@ class TestClzOp(OpTest):
...
@@ -60,12 +60,7 @@ class TestClzOp(OpTest):
low
=
INT32_MIN
if
dtype
==
"int32"
else
INT64_MIN
low
=
INT32_MIN
if
dtype
==
"int32"
else
INT64_MIN
high
=
INT32_MAX
if
dtype
==
"int32"
else
INT64_MAX
high
=
INT32_MAX
if
dtype
==
"int32"
else
INT64_MAX
x
=
self
.
random
(
self
.
case
[
"shape"
],
dtype
,
low
=
low
,
high
=
high
)
x
=
self
.
random
(
self
.
case
[
"shape"
],
dtype
,
low
=
low
,
high
=
high
)
y
=
list
(
y
=
[
count_leading_zeros
(
num
,
dtype
)
for
num
in
x
.
reshape
(
-
1
).
tolist
()]
map
(
lambda
num
:
count_leading_zeros
(
num
,
dtype
),
x
.
reshape
(
-
1
).
tolist
(),
)
)
self
.
inputs
=
{
"x"
:
x
}
self
.
inputs
=
{
"x"
:
x
}
self
.
outputs
=
{
"y"
:
np
.
array
(
y
).
reshape
(
x
.
shape
).
astype
(
dtype
)}
self
.
outputs
=
{
"y"
:
np
.
array
(
y
).
reshape
(
x
.
shape
).
astype
(
dtype
)}
...
...
test/cinn/ops/test_matmul_op.py
浏览文件 @
df6c74c3
...
@@ -72,7 +72,7 @@ class TestMatmulOp(OpTest):
...
@@ -72,7 +72,7 @@ class TestMatmulOp(OpTest):
out
=
self
.
cinn_func
(
builder
,
x
,
y
)
out
=
self
.
cinn_func
(
builder
,
x
,
y
)
prog
=
builder
.
build
()
prog
=
builder
.
build
()
res
=
self
.
get_cinn_output
(
res
=
self
.
get_cinn_output
(
prog
,
target
,
[
x
,
y
],
[
self
.
x_np
,
self
.
y_np
],
[
out
],
passes
=
list
()
prog
,
target
,
[
x
,
y
],
[
self
.
x_np
,
self
.
y_np
],
[
out
],
passes
=
[]
)
)
self
.
cinn_outputs
=
res
self
.
cinn_outputs
=
res
...
...
test/cinn/ops/test_popc_op.py
浏览文件 @
df6c74c3
...
@@ -61,7 +61,7 @@ class TestPopcOp(OpTest):
...
@@ -61,7 +61,7 @@ class TestPopcOp(OpTest):
low
=
INT32_MIN
if
dtype
==
"int32"
else
INT64_MIN
low
=
INT32_MIN
if
dtype
==
"int32"
else
INT64_MIN
high
=
INT32_MAX
if
dtype
==
"int32"
else
INT64_MAX
high
=
INT32_MAX
if
dtype
==
"int32"
else
INT64_MAX
x
=
self
.
random
(
self
.
case
[
"shape"
],
dtype
,
low
=
low
,
high
=
high
)
x
=
self
.
random
(
self
.
case
[
"shape"
],
dtype
,
low
=
low
,
high
=
high
)
y
=
list
(
map
(
lambda
num
:
popcount
(
num
,
dtype
),
x
.
reshape
(
-
1
).
tolist
()))
y
=
[
popcount
(
num
,
dtype
)
for
num
in
x
.
reshape
(
-
1
).
tolist
()]
self
.
inputs
=
{
"x"
:
x
}
self
.
inputs
=
{
"x"
:
x
}
self
.
outputs
=
{
"y"
:
np
.
array
(
y
).
reshape
(
x
.
shape
).
astype
(
dtype
)}
self
.
outputs
=
{
"y"
:
np
.
array
(
y
).
reshape
(
x
.
shape
).
astype
(
dtype
)}
...
...
test/cinn/passes/pass_test.py
浏览文件 @
df6c74c3
...
@@ -34,7 +34,7 @@ class PassTest(OpTest):
...
@@ -34,7 +34,7 @@ class PassTest(OpTest):
def
init_input_data
(
self
)
->
dict
:
def
init_input_data
(
self
)
->
dict
:
"""Set feed data"""
"""Set feed data"""
self
.
feed_data
=
dict
()
self
.
feed_data
=
{}
logger
.
warn
(
"No Input Data"
)
logger
.
warn
(
"No Input Data"
)
def
build_program
(
self
,
builder
,
target
):
def
build_program
(
self
,
builder
,
target
):
...
@@ -64,7 +64,7 @@ class PassTest(OpTest):
...
@@ -64,7 +64,7 @@ class PassTest(OpTest):
def
get_pass_outputs
(
self
,
passes
):
def
get_pass_outputs
(
self
,
passes
):
pass_prog
,
inputs
,
outputs
=
self
.
run_program
()
pass_prog
,
inputs
,
outputs
=
self
.
run_program
()
feed_list
=
list
()
feed_list
=
[]
for
var
in
inputs
:
for
var
in
inputs
:
self
.
assertIn
(
self
.
assertIn
(
var
.
name
(),
var
.
name
(),
...
...
test/cinn/test_paddle_model_convertor.py
浏览文件 @
df6c74c3
...
@@ -128,7 +128,7 @@ class TestPaddleModel(OpMapperTest):
...
@@ -128,7 +128,7 @@ class TestPaddleModel(OpMapperTest):
return
attr_map
return
attr_map
def
init_case
(
self
):
def
init_case
(
self
):
self
.
feed_data
=
dict
()
self
.
feed_data
=
{}
for
i
in
range
(
len
(
self
.
feed_names
)):
for
i
in
range
(
len
(
self
.
feed_names
)):
# check no repeat variable
# check no repeat variable
self
.
assertNotIn
(
self
.
assertNotIn
(
...
@@ -208,7 +208,7 @@ class TestPaddleModel(OpMapperTest):
...
@@ -208,7 +208,7 @@ class TestPaddleModel(OpMapperTest):
msg
=
"CINN only support single block now"
,
msg
=
"CINN only support single block now"
,
)
)
feed_with_param
=
list
()
feed_with_param
=
[]
convertor
=
PaddleModelConvertor
(
target
)
convertor
=
PaddleModelConvertor
(
target
)
for
i
in
range
(
len
(
self
.
feed_names
)):
for
i
in
range
(
len
(
self
.
feed_names
)):
...
...
tools/cinn/gen_c++_tutorial.py
浏览文件 @
df6c74c3
...
@@ -201,7 +201,7 @@ if __name__ == '__main__':
...
@@ -201,7 +201,7 @@ if __name__ == '__main__':
class
Content
(
ContentGenerator
):
class
Content
(
ContentGenerator
):
def
__init__
(
self
):
def
__init__
(
self
):
self
.
lines
=
[
line
for
line
in
sys
.
stdin
]
self
.
lines
=
list
(
sys
.
stdin
)
self
.
cur
=
0
self
.
cur
=
0
def
has_next
(
self
):
def
has_next
(
self
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录