Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
a057df50
P
Paddle
项目概览
机器未来
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
a057df50
编写于
4月 06, 2022
作者:
W
wanghuancoder
提交者:
GitHub
4月 06, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix split and concat out (#41419)
上级
91212104
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
15 addition
and
7 deletion
+15
-7
paddle/fluid/pybind/op_function_generator.h
paddle/fluid/pybind/op_function_generator.h
+2
-1
python/paddle/fluid/layers/nn.py
python/paddle/fluid/layers/nn.py
+3
-1
python/paddle/fluid/layers/tensor.py
python/paddle/fluid/layers/tensor.py
+3
-1
python/paddle/nn/utils/transform_parameters.py
python/paddle/nn/utils/transform_parameters.py
+5
-3
python/paddle/tensor/math.py
python/paddle/tensor/math.py
+2
-1
未找到文件。
paddle/fluid/pybind/op_function_generator.h
浏览文件 @
a057df50
...
...
@@ -227,7 +227,6 @@ std::map<std::string, std::set<std::string>> op_passing_outs_map = {
{
"c_reduce"
,
{
"Out"
}},
{
"c_scatter"
,
{
"Out"
}},
{
"barrier"
,
{
"Out"
}},
{
"assign"
,
{
"Out"
}},
{
"fake_quantize_dequantize_moving_average_abs_max"
,
{
"Out"
,
"OutScale"
,
"OutAccum"
,
"OutState"
}},
{
"fake_quantize_dequantize_abs_max"
,
{
"Out"
,
"OutScale"
}},
...
...
@@ -243,6 +242,8 @@ std::map<std::string, std::set<std::string>> op_passing_outs_map = {
{
"get_float_status"
,
{
"FloatStatusOut"
}},
{
"assign"
,
{
"Out"
}},
{
"assign_value"
,
{
"Out"
}},
{
"split"
,
{
"Out"
}},
{
"concat"
,
{
"Out"
}},
};
// NOTE(pangyoki): Tensor View Strategy.
...
...
python/paddle/fluid/layers/nn.py
浏览文件 @
a057df50
...
...
@@ -5026,7 +5026,9 @@ def split(input, num_or_sections, dim=-1, name=None):
raise TypeError(
"The type of 'num_or_sections' in split must be int, list or tuple in imperative mode, but "
"received %s." % (type(num_or_sections)))
return _C_ops.split(input, num, *attrs)
out = [_varbase_creator() for n in range(num)]
_C_ops.split(input, out, *attrs)
return out
check_variable_and_dtype(
input, 'input',
...
...
python/paddle/fluid/layers/tensor.py
浏览文件 @
a057df50
...
...
@@ -337,7 +337,9 @@ def concat(input, axis=0, name=None):
axis
=
axis
.
item
(
0
)
if
not
isinstance
(
input
,
Variable
):
input
=
[
t
for
t
in
input
if
t
.
shape
.
count
(
0
)
==
0
]
return
_C_ops
.
concat
(
input
,
'axis'
,
axis
)
out
=
_varbase_creator
()
_C_ops
.
concat
(
input
,
out
,
'axis'
,
axis
)
return
out
check_type
(
input
,
'input'
,
(
list
,
tuple
,
Variable
),
'concat'
)
if
not
isinstance
(
input
,
Variable
):
...
...
python/paddle/nn/utils/transform_parameters.py
浏览文件 @
a057df50
...
...
@@ -69,7 +69,9 @@ def parameters_to_vector(parameters, name=None):
out
=
_varbase_creator
(
dtype
=
dtype
)
if
in_dygraph_mode
():
with
paddle
.
fluid
.
dygraph
.
no_grad
():
_C_ops
.
concat
(
parameters
,
'axis'
,
0
).
_share_underline_tensor_to
(
out
)
tmp
=
_varbase_creator
()
_C_ops
.
concat
(
parameters
,
tmp
,
'axis'
,
0
)
tmp
.
_share_underline_tensor_to
(
out
)
else
:
_dygraph_tracer
().
trace_op
(
type
=
'concat'
,
...
...
@@ -120,8 +122,8 @@ def vector_to_parameters(vec, parameters, name=None):
if
in_dygraph_mode
():
with
paddle
.
fluid
.
dygraph
.
no_grad
():
res
=
_C_ops
.
split
(
vec
,
len
(
parameters
)
,
'axis'
,
0
,
'sections'
,
sections
)
res
=
[
_varbase_creator
()
for
n
in
range
(
len
(
parameters
))]
_C_ops
.
split
(
vec
,
res
,
'axis'
,
0
,
'sections'
,
sections
)
for
i
in
range
(
0
,
len
(
res
)):
res
[
i
].
_share_underline_tensor_to
(
parameters
[
i
])
else
:
...
...
python/paddle/tensor/math.py
浏览文件 @
a057df50
...
...
@@ -3911,7 +3911,8 @@ def diff(x, n=1, axis=-1, prepend=None, append=None, name=None):
input_list
=
[
x
,
append
]
has_pend
=
True
if
has_pend
:
new_input
=
_C_ops
.
concat
(
input_list
,
'axis'
,
axis
)
new_input
=
_varbase_creator
()
_C_ops
.
concat
(
input_list
,
new_input
,
'axis'
,
axis
)
else
:
new_input
=
x
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录