Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Crayon鑫
Paddle
提交
384062fa
P
Paddle
项目概览
Crayon鑫
/
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看板
未验证
提交
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,
void
SqueezeInferMeta
(
const
MetaTensor
&
x
,
const
std
::
vector
<
int
>&
axes
,
MetaTensor
*
xshape
,
MetaTensor
*
out
)
{
MetaTensor
*
out
,
MetaTensor
*
xshape
)
{
const
auto
&
x_dims
=
x
.
dims
();
// Check input tensor dims (<6) Eigen limit.
PADDLE_ENFORCE_LE
(
x_dims
.
size
(),
...
...
@@ -2964,8 +2964,8 @@ void UniqueRawInferMeta(const MetaTensor& x,
void
UnsqueezeInferMeta
(
const
MetaTensor
&
x
,
const
IntArray
&
axes
,
MetaTensor
*
xshape
,
MetaTensor
*
out
,
MetaTensor
*
xshape
,
MetaConfig
config
)
{
const
auto
&
x_dims
=
x
.
dims
();
// Validity Check: input tensor dims (<6).
...
...
paddle/phi/infermeta/unary.h
浏览文件 @
384062fa
...
...
@@ -306,8 +306,8 @@ void SplitInferMeta(const MetaTensor& x_meta,
void
SqueezeInferMeta
(
const
MetaTensor
&
x
,
const
std
::
vector
<
int
>&
axes
,
MetaTensor
*
xshape
,
MetaTensor
*
out
);
MetaTensor
*
out
,
MetaTensor
*
xshape
);
void
StridedSliceRawInferMeta
(
const
MetaTensor
&
x
,
const
std
::
vector
<
int
>&
axes
,
...
...
@@ -425,8 +425,8 @@ void UniqueRawInferMeta(const MetaTensor& x,
void
UnsqueezeInferMeta
(
const
MetaTensor
&
x
,
const
IntArray
&
axes
,
MetaTensor
*
xshape
,
MetaTensor
*
out
,
MetaTensor
*
xshape
,
MetaConfig
config
=
MetaConfig
());
void
UnStackInferMeta
(
const
MetaTensor
&
x
,
...
...
paddle/phi/kernels/impl/squeeze_kernel_impl.h
浏览文件 @
384062fa
...
...
@@ -22,8 +22,8 @@ template <typename T, typename Context>
void
SqueezeKernel
(
const
Context
&
dev_ctx
,
const
DenseTensor
&
x
,
const
std
::
vector
<
int
>&
axes
,
DenseTensor
*
xshape
,
DenseTensor
*
out
)
{
DenseTensor
*
out
,
DenseTensor
*
xshape
)
{
auto
x_dims
=
x
.
dims
();
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>
void
UnsqueezeKernel
(
const
Context
&
dev_ctx
,
const
DenseTensor
&
x
,
const
IntArray
&
axes
,
DenseTensor
*
xshape
,
DenseTensor
*
out
)
{
DenseTensor
*
out
,
DenseTensor
*
xshape
)
{
auto
x_dims
=
x
.
dims
();
auto
out_dims
=
out
->
dims
();
if
(
axes
.
FromTensor
())
{
...
...
paddle/phi/kernels/squeeze_kernel.h
浏览文件 @
384062fa
...
...
@@ -23,6 +23,6 @@ template <typename T, typename Context>
void
SqueezeKernel
(
const
Context
&
dev_ctx
,
const
DenseTensor
&
x
,
const
std
::
vector
<
int
>&
axes
,
DenseTensor
*
xshape
,
DenseTensor
*
out
);
DenseTensor
*
out
,
DenseTensor
*
xshape
);
}
// namespace phi
paddle/phi/kernels/unsqueeze_kernel.h
浏览文件 @
384062fa
...
...
@@ -24,6 +24,6 @@ template <typename T, typename Context>
void
UnsqueezeKernel
(
const
Context
&
dev_ctx
,
const
DenseTensor
&
x
,
const
IntArray
&
axes
,
DenseTensor
*
xshape
,
DenseTensor
*
out
);
DenseTensor
*
out
,
DenseTensor
*
xshape
);
}
// namespace phi
paddle/phi/ops/compat/squeeze_sig.cc
浏览文件 @
384062fa
...
...
@@ -18,7 +18,7 @@
namespace
phi
{
KernelSignature
SqueezeOpArgumentMapping
(
const
ArgumentMappingContext
&
ctx
)
{
return
KernelSignature
(
"squeeze"
,
{
"X"
},
{
"axes"
},
{
"
XShape"
,
"Out
"
});
return
KernelSignature
(
"squeeze"
,
{
"X"
},
{
"axes"
},
{
"
Out"
,
"XShape
"
});
}
KernelSignature
SqueezeGradOpArgumentMapping
(
...
...
paddle/phi/ops/compat/unsqueeze_sig.cc
浏览文件 @
384062fa
...
...
@@ -21,14 +21,14 @@ KernelSignature UnsqueezeOpArgumentMapping(const ArgumentMappingContext& ctx) {
if
(
ctx
.
InputSize
(
"AxesTensorList"
)
>
0
)
{
VLOG
(
2
)
<<
"unsqueeze2 in AxesTensorList"
;
return
KernelSignature
(
"unsqueeze"
,
{
"X"
},
{
"AxesTensorList"
},
{
"
XShape"
,
"Out
"
});
"unsqueeze"
,
{
"X"
},
{
"AxesTensorList"
},
{
"
Out"
,
"XShape
"
});
}
else
if
(
ctx
.
InputSize
(
"AxesTensor"
)
>
0
)
{
VLOG
(
2
)
<<
"unsqueeze2 in AxesTensor"
;
return
KernelSignature
(
"unsqueeze"
,
{
"X"
},
{
"AxesTensor"
},
{
"
XShape"
,
"Out
"
});
"unsqueeze"
,
{
"X"
},
{
"AxesTensor"
},
{
"
Out"
,
"XShape
"
});
}
else
{
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):
"""
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():
out, _ = _C_ops.squeeze2(input, 'axes', axes)
return out
...
...
@@ -6598,7 +6598,7 @@ def unsqueeze(input, axes, name=None):
if _in_legacy_dygraph():
out, _ = _C_ops.unsqueeze2(input, 'axes', axes)
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_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):
raise
ValueError
(
"The stop_axis should be larger than stat_axis"
)
if
in_dygraph_mode
():
dy_out
,
_
=
_C_ops
.
final_state_flatten
(
x
,
start_axis
,
stop_axis
)
return
dy_out
return
_C_ops
.
final_state_flatten
(
x
,
start_axis
,
stop_axis
)
if
_in_legacy_dygraph
():
dy_out
,
_
=
_C_ops
.
flatten_contiguous_range
(
x
,
'start_axis'
,
start_axis
,
...
...
@@ -1936,7 +1935,7 @@ def squeeze(x, axis=None, name=None):
input
=
x
axes
=
axis
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
():
out
,
_
=
_C_ops
.
squeeze2
(
input
,
'axes'
,
axes
)
return
out
...
...
@@ -2271,7 +2270,7 @@ def unsqueeze(x, axis, name=None):
if
_in_legacy_dygraph
():
out
,
_
=
_C_ops
.
unsqueeze2
(
input
,
'axes'
,
axes
)
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_variable_and_dtype
(
input
,
'input'
,
[
...
...
python/paddle/utils/code_gen/api.yaml
浏览文件 @
384062fa
...
...
@@ -714,7 +714,7 @@
backend
:
x
inplace
:
(x -> out)
view
:
(x -> out)
#
intermediate : xshape
intermediate
:
xshape
backward
:
flatten_grad
# flip
...
...
@@ -1984,12 +1984,13 @@
-
api
:
squeeze
args
:
(Tensor x, int[] axes)
output
:
Tensor(
xshape), Tensor(out
)
output
:
Tensor(
out), Tensor(xshape
)
infer_meta
:
func
:
SqueezeInferMeta
kernel
:
func
:
squeeze
view
:
(x -> out)
intermediate
:
xshape
backward
:
squeeze_grad
-
api
:
stack
...
...
@@ -2213,12 +2214,13 @@
-
api
:
unsqueeze
args
:
(Tensor x, IntArray axis)
output
:
Tensor(
xshape), Tensor(out
)
output
:
Tensor(
out), Tensor(xshape
)
infer_meta
:
func
:
UnsqueezeInferMeta
kernel
:
func
:
unsqueeze
view
:
(x -> out)
intermediate
:
xshape
backward
:
unsqueeze_grad
# viterbi_decode
...
...
python/paddle/utils/code_gen/backward.yaml
浏览文件 @
384062fa
...
...
@@ -1750,7 +1750,7 @@
func
:
square_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)
output
:
Tensor(x_grad)
infer_meta
:
...
...
@@ -2021,7 +2021,7 @@
no_need_buffer
:
x
-
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)
output
:
Tensor(x_grad)
infer_meta
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录