Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
384062fa
P
Paddle
项目概览
PaddlePaddle
/
Paddle
接近 2 年 前同步成功
通知
2323
Star
20933
Fork
5424
代码
文件
提交
分支
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看板
未验证
提交
384062fa
编写于
5月 18, 2022
作者:
Z
zyfncg
提交者:
GitHub
5月 18, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add intermediate config for some api in yaml (#42824)
* add intermediate for some api * fix bug * fix fluid.layer
上级
efaaf239
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
30 addition
and
29 deletion
+30
-29
paddle/phi/infermeta/unary.cc
paddle/phi/infermeta/unary.cc
+3
-3
paddle/phi/infermeta/unary.h
paddle/phi/infermeta/unary.h
+3
-3
paddle/phi/kernels/impl/squeeze_kernel_impl.h
paddle/phi/kernels/impl/squeeze_kernel_impl.h
+2
-2
paddle/phi/kernels/impl/unsqueeze_kernel_impl.h
paddle/phi/kernels/impl/unsqueeze_kernel_impl.h
+2
-2
paddle/phi/kernels/squeeze_kernel.h
paddle/phi/kernels/squeeze_kernel.h
+2
-2
paddle/phi/kernels/unsqueeze_kernel.h
paddle/phi/kernels/unsqueeze_kernel.h
+2
-2
paddle/phi/ops/compat/squeeze_sig.cc
paddle/phi/ops/compat/squeeze_sig.cc
+1
-1
paddle/phi/ops/compat/unsqueeze_sig.cc
paddle/phi/ops/compat/unsqueeze_sig.cc
+3
-3
python/paddle/fluid/layers/nn.py
python/paddle/fluid/layers/nn.py
+2
-2
python/paddle/tensor/manipulation.py
python/paddle/tensor/manipulation.py
+3
-4
python/paddle/utils/code_gen/api.yaml
python/paddle/utils/code_gen/api.yaml
+5
-3
python/paddle/utils/code_gen/backward.yaml
python/paddle/utils/code_gen/backward.yaml
+2
-2
未找到文件。
paddle/phi/infermeta/unary.cc
浏览文件 @
384062fa
...
@@ -2163,8 +2163,8 @@ void SplitInferMeta(const MetaTensor& x,
...
@@ -2163,8 +2163,8 @@ void SplitInferMeta(const MetaTensor& x,
void
SqueezeInferMeta
(
const
MetaTensor
&
x
,
void
SqueezeInferMeta
(
const
MetaTensor
&
x
,
const
std
::
vector
<
int
>&
axes
,
const
std
::
vector
<
int
>&
axes
,
MetaTensor
*
xshape
,
MetaTensor
*
out
,
MetaTensor
*
out
)
{
MetaTensor
*
xshape
)
{
const
auto
&
x_dims
=
x
.
dims
();
const
auto
&
x_dims
=
x
.
dims
();
// Check input tensor dims (<6) Eigen limit.
// Check input tensor dims (<6) Eigen limit.
PADDLE_ENFORCE_LE
(
x_dims
.
size
(),
PADDLE_ENFORCE_LE
(
x_dims
.
size
(),
...
@@ -2964,8 +2964,8 @@ void UniqueRawInferMeta(const MetaTensor& x,
...
@@ -2964,8 +2964,8 @@ void UniqueRawInferMeta(const MetaTensor& x,
void
UnsqueezeInferMeta
(
const
MetaTensor
&
x
,
void
UnsqueezeInferMeta
(
const
MetaTensor
&
x
,
const
IntArray
&
axes
,
const
IntArray
&
axes
,
MetaTensor
*
xshape
,
MetaTensor
*
out
,
MetaTensor
*
out
,
MetaTensor
*
xshape
,
MetaConfig
config
)
{
MetaConfig
config
)
{
const
auto
&
x_dims
=
x
.
dims
();
const
auto
&
x_dims
=
x
.
dims
();
// Validity Check: input tensor dims (<6).
// Validity Check: input tensor dims (<6).
...
...
paddle/phi/infermeta/unary.h
浏览文件 @
384062fa
...
@@ -306,8 +306,8 @@ void SplitInferMeta(const MetaTensor& x_meta,
...
@@ -306,8 +306,8 @@ void SplitInferMeta(const MetaTensor& x_meta,
void
SqueezeInferMeta
(
const
MetaTensor
&
x
,
void
SqueezeInferMeta
(
const
MetaTensor
&
x
,
const
std
::
vector
<
int
>&
axes
,
const
std
::
vector
<
int
>&
axes
,
MetaTensor
*
xshape
,
MetaTensor
*
out
,
MetaTensor
*
out
);
MetaTensor
*
xshape
);
void
StridedSliceRawInferMeta
(
const
MetaTensor
&
x
,
void
StridedSliceRawInferMeta
(
const
MetaTensor
&
x
,
const
std
::
vector
<
int
>&
axes
,
const
std
::
vector
<
int
>&
axes
,
...
@@ -425,8 +425,8 @@ void UniqueRawInferMeta(const MetaTensor& x,
...
@@ -425,8 +425,8 @@ void UniqueRawInferMeta(const MetaTensor& x,
void
UnsqueezeInferMeta
(
const
MetaTensor
&
x
,
void
UnsqueezeInferMeta
(
const
MetaTensor
&
x
,
const
IntArray
&
axes
,
const
IntArray
&
axes
,
MetaTensor
*
xshape
,
MetaTensor
*
out
,
MetaTensor
*
out
,
MetaTensor
*
xshape
,
MetaConfig
config
=
MetaConfig
());
MetaConfig
config
=
MetaConfig
());
void
UnStackInferMeta
(
const
MetaTensor
&
x
,
void
UnStackInferMeta
(
const
MetaTensor
&
x
,
...
...
paddle/phi/kernels/impl/squeeze_kernel_impl.h
浏览文件 @
384062fa
...
@@ -22,8 +22,8 @@ template <typename T, typename Context>
...
@@ -22,8 +22,8 @@ template <typename T, typename Context>
void
SqueezeKernel
(
const
Context
&
dev_ctx
,
void
SqueezeKernel
(
const
Context
&
dev_ctx
,
const
DenseTensor
&
x
,
const
DenseTensor
&
x
,
const
std
::
vector
<
int
>&
axes
,
const
std
::
vector
<
int
>&
axes
,
DenseTensor
*
xshape
,
DenseTensor
*
out
,
DenseTensor
*
out
)
{
DenseTensor
*
xshape
)
{
auto
x_dims
=
x
.
dims
();
auto
x_dims
=
x
.
dims
();
auto
out_dims
=
funcs
::
GetOutputSqueezeShape
(
axes
,
x_dims
,
true
);
auto
out_dims
=
funcs
::
GetOutputSqueezeShape
(
axes
,
x_dims
,
true
);
...
...
paddle/phi/kernels/impl/unsqueeze_kernel_impl.h
浏览文件 @
384062fa
...
@@ -22,8 +22,8 @@ template <typename T, typename Context>
...
@@ -22,8 +22,8 @@ template <typename T, typename Context>
void
UnsqueezeKernel
(
const
Context
&
dev_ctx
,
void
UnsqueezeKernel
(
const
Context
&
dev_ctx
,
const
DenseTensor
&
x
,
const
DenseTensor
&
x
,
const
IntArray
&
axes
,
const
IntArray
&
axes
,
DenseTensor
*
xshape
,
DenseTensor
*
out
,
DenseTensor
*
out
)
{
DenseTensor
*
xshape
)
{
auto
x_dims
=
x
.
dims
();
auto
x_dims
=
x
.
dims
();
auto
out_dims
=
out
->
dims
();
auto
out_dims
=
out
->
dims
();
if
(
axes
.
FromTensor
())
{
if
(
axes
.
FromTensor
())
{
...
...
paddle/phi/kernels/squeeze_kernel.h
浏览文件 @
384062fa
...
@@ -23,6 +23,6 @@ template <typename T, typename Context>
...
@@ -23,6 +23,6 @@ template <typename T, typename Context>
void
SqueezeKernel
(
const
Context
&
dev_ctx
,
void
SqueezeKernel
(
const
Context
&
dev_ctx
,
const
DenseTensor
&
x
,
const
DenseTensor
&
x
,
const
std
::
vector
<
int
>&
axes
,
const
std
::
vector
<
int
>&
axes
,
DenseTensor
*
xshape
,
DenseTensor
*
out
,
DenseTensor
*
out
);
DenseTensor
*
xshape
);
}
// namespace phi
}
// namespace phi
paddle/phi/kernels/unsqueeze_kernel.h
浏览文件 @
384062fa
...
@@ -24,6 +24,6 @@ template <typename T, typename Context>
...
@@ -24,6 +24,6 @@ template <typename T, typename Context>
void
UnsqueezeKernel
(
const
Context
&
dev_ctx
,
void
UnsqueezeKernel
(
const
Context
&
dev_ctx
,
const
DenseTensor
&
x
,
const
DenseTensor
&
x
,
const
IntArray
&
axes
,
const
IntArray
&
axes
,
DenseTensor
*
xshape
,
DenseTensor
*
out
,
DenseTensor
*
out
);
DenseTensor
*
xshape
);
}
// namespace phi
}
// namespace phi
paddle/phi/ops/compat/squeeze_sig.cc
浏览文件 @
384062fa
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
namespace
phi
{
namespace
phi
{
KernelSignature
SqueezeOpArgumentMapping
(
const
ArgumentMappingContext
&
ctx
)
{
KernelSignature
SqueezeOpArgumentMapping
(
const
ArgumentMappingContext
&
ctx
)
{
return
KernelSignature
(
"squeeze"
,
{
"X"
},
{
"axes"
},
{
"
XShape"
,
"Out
"
});
return
KernelSignature
(
"squeeze"
,
{
"X"
},
{
"axes"
},
{
"
Out"
,
"XShape
"
});
}
}
KernelSignature
SqueezeGradOpArgumentMapping
(
KernelSignature
SqueezeGradOpArgumentMapping
(
...
...
paddle/phi/ops/compat/unsqueeze_sig.cc
浏览文件 @
384062fa
...
@@ -21,14 +21,14 @@ KernelSignature UnsqueezeOpArgumentMapping(const ArgumentMappingContext& ctx) {
...
@@ -21,14 +21,14 @@ KernelSignature UnsqueezeOpArgumentMapping(const ArgumentMappingContext& ctx) {
if
(
ctx
.
InputSize
(
"AxesTensorList"
)
>
0
)
{
if
(
ctx
.
InputSize
(
"AxesTensorList"
)
>
0
)
{
VLOG
(
2
)
<<
"unsqueeze2 in AxesTensorList"
;
VLOG
(
2
)
<<
"unsqueeze2 in AxesTensorList"
;
return
KernelSignature
(
return
KernelSignature
(
"unsqueeze"
,
{
"X"
},
{
"AxesTensorList"
},
{
"
XShape"
,
"Out
"
});
"unsqueeze"
,
{
"X"
},
{
"AxesTensorList"
},
{
"
Out"
,
"XShape
"
});
}
else
if
(
ctx
.
InputSize
(
"AxesTensor"
)
>
0
)
{
}
else
if
(
ctx
.
InputSize
(
"AxesTensor"
)
>
0
)
{
VLOG
(
2
)
<<
"unsqueeze2 in AxesTensor"
;
VLOG
(
2
)
<<
"unsqueeze2 in AxesTensor"
;
return
KernelSignature
(
return
KernelSignature
(
"unsqueeze"
,
{
"X"
},
{
"AxesTensor"
},
{
"
XShape"
,
"Out
"
});
"unsqueeze"
,
{
"X"
},
{
"AxesTensor"
},
{
"
Out"
,
"XShape
"
});
}
else
{
}
else
{
VLOG
(
2
)
<<
"unsqueeze2 in axes"
;
VLOG
(
2
)
<<
"unsqueeze2 in axes"
;
return
KernelSignature
(
"unsqueeze"
,
{
"X"
},
{
"axes"
},
{
"
XShape"
,
"Out
"
});
return
KernelSignature
(
"unsqueeze"
,
{
"X"
},
{
"axes"
},
{
"
Out"
,
"XShape
"
});
}
}
}
}
...
...
python/paddle/fluid/layers/nn.py
浏览文件 @
384062fa
...
@@ -6533,7 +6533,7 @@ def squeeze(input, axes, name=None):
...
@@ -6533,7 +6533,7 @@ def squeeze(input, axes, name=None):
"""
"""
if in_dygraph_mode():
if in_dygraph_mode():
return _C_ops.final_state_squeeze(input, axes)
[1]
return _C_ops.final_state_squeeze(input, axes)
if _in_legacy_dygraph():
if _in_legacy_dygraph():
out, _ = _C_ops.squeeze2(input, 'axes', axes)
out, _ = _C_ops.squeeze2(input, 'axes', axes)
return out
return out
...
@@ -6598,7 +6598,7 @@ def unsqueeze(input, axes, name=None):
...
@@ -6598,7 +6598,7 @@ def unsqueeze(input, axes, name=None):
if _in_legacy_dygraph():
if _in_legacy_dygraph():
out, _ = _C_ops.unsqueeze2(input, 'axes', axes)
out, _ = _C_ops.unsqueeze2(input, 'axes', axes)
return out
return out
return _C_ops.final_state_unsqueeze(input, axes)
[1]
return _C_ops.final_state_unsqueeze(input, axes)
check_type(axes, 'axis/axes', (int, list, tuple, Variable), 'unsqueeze')
check_type(axes, 'axis/axes', (int, list, tuple, Variable), 'unsqueeze')
check_variable_and_dtype(input, 'input', [
check_variable_and_dtype(input, 'input', [
...
...
python/paddle/tensor/manipulation.py
浏览文件 @
384062fa
...
@@ -1427,8 +1427,7 @@ def flatten(x, start_axis=0, stop_axis=-1, name=None):
...
@@ -1427,8 +1427,7 @@ def flatten(x, start_axis=0, stop_axis=-1, name=None):
raise
ValueError
(
"The stop_axis should be larger than stat_axis"
)
raise
ValueError
(
"The stop_axis should be larger than stat_axis"
)
if
in_dygraph_mode
():
if
in_dygraph_mode
():
dy_out
,
_
=
_C_ops
.
final_state_flatten
(
x
,
start_axis
,
stop_axis
)
return
_C_ops
.
final_state_flatten
(
x
,
start_axis
,
stop_axis
)
return
dy_out
if
_in_legacy_dygraph
():
if
_in_legacy_dygraph
():
dy_out
,
_
=
_C_ops
.
flatten_contiguous_range
(
x
,
'start_axis'
,
start_axis
,
dy_out
,
_
=
_C_ops
.
flatten_contiguous_range
(
x
,
'start_axis'
,
start_axis
,
...
@@ -1936,7 +1935,7 @@ def squeeze(x, axis=None, name=None):
...
@@ -1936,7 +1935,7 @@ def squeeze(x, axis=None, name=None):
input
=
x
input
=
x
axes
=
axis
axes
=
axis
if
in_dygraph_mode
():
if
in_dygraph_mode
():
return
_C_ops
.
final_state_squeeze
(
input
,
axes
)
[
1
]
return
_C_ops
.
final_state_squeeze
(
input
,
axes
)
if
_in_legacy_dygraph
():
if
_in_legacy_dygraph
():
out
,
_
=
_C_ops
.
squeeze2
(
input
,
'axes'
,
axes
)
out
,
_
=
_C_ops
.
squeeze2
(
input
,
'axes'
,
axes
)
return
out
return
out
...
@@ -2271,7 +2270,7 @@ def unsqueeze(x, axis, name=None):
...
@@ -2271,7 +2270,7 @@ def unsqueeze(x, axis, name=None):
if
_in_legacy_dygraph
():
if
_in_legacy_dygraph
():
out
,
_
=
_C_ops
.
unsqueeze2
(
input
,
'axes'
,
axes
)
out
,
_
=
_C_ops
.
unsqueeze2
(
input
,
'axes'
,
axes
)
return
out
return
out
return
_C_ops
.
final_state_unsqueeze
(
input
,
axes
)
[
1
]
return
_C_ops
.
final_state_unsqueeze
(
input
,
axes
)
check_type
(
axes
,
'axis/axes'
,
(
int
,
list
,
tuple
,
Variable
),
'unsqueeze'
)
check_type
(
axes
,
'axis/axes'
,
(
int
,
list
,
tuple
,
Variable
),
'unsqueeze'
)
check_variable_and_dtype
(
input
,
'input'
,
[
check_variable_and_dtype
(
input
,
'input'
,
[
...
...
python/paddle/utils/code_gen/api.yaml
浏览文件 @
384062fa
...
@@ -714,7 +714,7 @@
...
@@ -714,7 +714,7 @@
backend
:
x
backend
:
x
inplace
:
(x -> out)
inplace
:
(x -> out)
view
:
(x -> out)
view
:
(x -> out)
#
intermediate : xshape
intermediate
:
xshape
backward
:
flatten_grad
backward
:
flatten_grad
# flip
# flip
...
@@ -1984,12 +1984,13 @@
...
@@ -1984,12 +1984,13 @@
-
api
:
squeeze
-
api
:
squeeze
args
:
(Tensor x, int[] axes)
args
:
(Tensor x, int[] axes)
output
:
Tensor(
xshape), Tensor(out
)
output
:
Tensor(
out), Tensor(xshape
)
infer_meta
:
infer_meta
:
func
:
SqueezeInferMeta
func
:
SqueezeInferMeta
kernel
:
kernel
:
func
:
squeeze
func
:
squeeze
view
:
(x -> out)
view
:
(x -> out)
intermediate
:
xshape
backward
:
squeeze_grad
backward
:
squeeze_grad
-
api
:
stack
-
api
:
stack
...
@@ -2213,12 +2214,13 @@
...
@@ -2213,12 +2214,13 @@
-
api
:
unsqueeze
-
api
:
unsqueeze
args
:
(Tensor x, IntArray axis)
args
:
(Tensor x, IntArray axis)
output
:
Tensor(
xshape), Tensor(out
)
output
:
Tensor(
out), Tensor(xshape
)
infer_meta
:
infer_meta
:
func
:
UnsqueezeInferMeta
func
:
UnsqueezeInferMeta
kernel
:
kernel
:
func
:
unsqueeze
func
:
unsqueeze
view
:
(x -> out)
view
:
(x -> out)
intermediate
:
xshape
backward
:
unsqueeze_grad
backward
:
unsqueeze_grad
# viterbi_decode
# viterbi_decode
...
...
python/paddle/utils/code_gen/backward.yaml
浏览文件 @
384062fa
...
@@ -1750,7 +1750,7 @@
...
@@ -1750,7 +1750,7 @@
func
:
square_grad
func
:
square_grad
-
backward_api
:
squeeze_grad
-
backward_api
:
squeeze_grad
forward
:
squeeze(Tensor x, int[] axes) -> Tensor(
xshape), Tensor(out
)
forward
:
squeeze(Tensor x, int[] axes) -> Tensor(
out), Tensor(xshape
)
args
:
(Tensor xshape, Tensor out_grad, int[] axes)
args
:
(Tensor xshape, Tensor out_grad, int[] axes)
output
:
Tensor(x_grad)
output
:
Tensor(x_grad)
infer_meta
:
infer_meta
:
...
@@ -2021,7 +2021,7 @@
...
@@ -2021,7 +2021,7 @@
no_need_buffer
:
x
no_need_buffer
:
x
-
backward_api
:
unsqueeze_grad
-
backward_api
:
unsqueeze_grad
forward
:
unsqueeze(Tensor x, IntArray axes) -> Tensor(
xshape), Tensor(out
)
forward
:
unsqueeze(Tensor x, IntArray axes) -> Tensor(
out), Tensor(xshape
)
args
:
(Tensor xshape, Tensor out_grad)
args
:
(Tensor xshape, Tensor out_grad)
output
:
Tensor(x_grad)
output
:
Tensor(x_grad)
infer_meta
:
infer_meta
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录