Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
eb93b5c9
P
Paddle
项目概览
PaddlePaddle
/
Paddle
1 年多 前同步成功
通知
2305
Star
20932
Fork
5423
代码
文件
提交
分支
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看板
未验证
提交
eb93b5c9
编写于
4月 13, 2023
作者:
Z
zhangyuqin1998
提交者:
GitHub
4月 13, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rename_bilinear_tensor_op (#52745)
上级
5ab07e04
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
82 addition
and
82 deletion
+82
-82
paddle/phi/api/yaml/backward.yaml
paddle/phi/api/yaml/backward.yaml
+9
-9
paddle/phi/api/yaml/op_compat.yaml
paddle/phi/api/yaml/op_compat.yaml
+6
-6
paddle/phi/api/yaml/ops.yaml
paddle/phi/api/yaml/ops.yaml
+10
-10
paddle/phi/infermeta/backward.cc
paddle/phi/infermeta/backward.cc
+8
-8
paddle/phi/infermeta/backward.h
paddle/phi/infermeta/backward.h
+8
-8
paddle/phi/kernels/cpu/slice_grad_kernel.cc
paddle/phi/kernels/cpu/slice_grad_kernel.cc
+1
-1
paddle/phi/kernels/gpu/slice_grad_kernel.cu.cc
paddle/phi/kernels/gpu/slice_grad_kernel.cu.cc
+1
-1
paddle/phi/kernels/impl/slice_grad_kernel_impl.h
paddle/phi/kernels/impl/slice_grad_kernel_impl.h
+9
-9
paddle/phi/kernels/onednn/slice_grad_kernel.cc
paddle/phi/kernels/onednn/slice_grad_kernel.cc
+10
-10
paddle/phi/kernels/slice_grad_kernel.h
paddle/phi/kernels/slice_grad_kernel.h
+9
-9
paddle/phi/kernels/xpu/slice_grad_kernel.cc
paddle/phi/kernels/xpu/slice_grad_kernel.cc
+10
-10
python/paddle/nn/functional/common.py
python/paddle/nn/functional/common.py
+1
-1
未找到文件。
paddle/phi/api/yaml/backward.yaml
浏览文件 @
eb93b5c9
...
...
@@ -158,6 +158,15 @@
data_transform
:
skip_transform
:
out_size, size_tensor, scale_tensor
-
backward_op
:
bilinear_grad
forward
:
bilinear (Tensor x, Tensor y, Tensor weight, Tensor bias) -> Tensor(out)
args
:
(Tensor x, Tensor y, Tensor weight, Tensor out_grad)
output
:
Tensor(x_grad), Tensor(y_grad), Tensor(weight_grad), Tensor(bias_grad)
infer_meta
:
func
:
BilinearGradInferMeta
kernel
:
func
:
bilinear_grad
-
backward_op
:
bilinear_interp_grad
forward
:
bilinear_interp (Tensor x, Tensor out_size, Tensor[] size_tensor, Tensor scale_tensor, str data_layout="NCHW", int out_d=0, int out_h=0, int out_w=0, float[] scale={}, str interp_method="bilinear", bool align_corners=true, int align_mode=1) -> Tensor(output)
args
:
(Tensor x, Tensor out_size, Tensor[] size_tensor, Tensor scale_tensor, Tensor output_grad, str data_layout, int out_d, int out_h, int out_w, float[] scale, str interp_method, bool align_corners, int align_mode)
...
...
@@ -173,15 +182,6 @@
data_transform
:
skip_transform
:
out_size, size_tensor, scale_tensor
-
backward_op
:
bilinear_tensor_product_grad
forward
:
bilinear_tensor_product (Tensor x, Tensor y, Tensor weight, Tensor bias) -> Tensor(out)
args
:
(Tensor x, Tensor y, Tensor weight, Tensor out_grad)
output
:
Tensor(x_grad), Tensor(y_grad), Tensor(weight_grad), Tensor(bias_grad)
infer_meta
:
func
:
BilinearTensorProductGradInferMeta
kernel
:
func
:
bilinear_grad
-
backward_op
:
bmm_grad
forward
:
bmm (Tensor x, Tensor y) -> Tensor(out)
args
:
(Tensor x, Tensor y, Tensor out_grad)
...
...
paddle/phi/api/yaml/op_compat.yaml
浏览文件 @
eb93b5c9
...
...
@@ -265,6 +265,12 @@
extra
:
attrs
:
[
bool use_mkldnn = false
]
-
op
:
bilinear (bilinear_tensor_product)
inputs
:
{
x
:
X
,
y
:
Y
,
weight
:
Weight
,
bias
:
Bias
}
outputs
:
{
out
:
Out
}
-
op
:
bilinear_interp (bilinear_interp_v2)
backward
:
bilinear_interp_grad (bilinear_interp_v2_grad)
inputs
:
...
...
@@ -274,12 +280,6 @@
extra
:
attrs
:
[
bool use_mkldnn = false
]
-
op
:
bilinear_tensor_product
inputs
:
{
x
:
X
,
y
:
Y
,
weight
:
Weight
,
bias
:
Bias
}
outputs
:
{
out
:
Out
}
-
op
:
bitwise_and
inputs
:
{
x
:
X
,
y
:
Y
}
...
...
paddle/phi/api/yaml/ops.yaml
浏览文件 @
eb93b5c9
...
...
@@ -238,6 +238,16 @@
data_transform
:
skip_transform
:
out_size, size_tensor, scale_tensor
-
op
:
bilinear
args
:
(Tensor x, Tensor y, Tensor weight, Tensor bias)
output
:
Tensor
infer_meta
:
func
:
BilinearInferMeta
kernel
:
func
:
bilinear
optional
:
bias
backward
:
bilinear_grad
-
op
:
bilinear_interp
args
:
(Tensor x, Tensor out_size, Tensor[] size_tensor, Tensor scale_tensor, str data_layout="NCHW", int out_d=0, int out_h=0, int out_w=0, float[] scale={}, str interp_method="bilinear", bool align_corners=true, int align_mode=1)
output
:
Tensor(output)
...
...
@@ -251,16 +261,6 @@
data_transform
:
skip_transform
:
out_size, size_tensor, scale_tensor
-
op
:
bilinear_tensor_product
args
:
(Tensor x, Tensor y, Tensor weight, Tensor bias)
output
:
Tensor
infer_meta
:
func
:
BilinearInferMeta
kernel
:
func
:
bilinear
optional
:
bias
backward
:
bilinear_tensor_product_grad
-
op
:
bitwise_and
args
:
(Tensor x, Tensor y)
output
:
Tensor(out)
...
...
paddle/phi/infermeta/backward.cc
浏览文件 @
eb93b5c9
...
...
@@ -39,14 +39,14 @@ void AngleGradInferMeta(const MetaTensor& x,
UnchangedInferMeta
(
x
,
x_grad
);
}
void
Bilinear
TensorProduct
GradInferMeta
(
const
MetaTensor
&
x
,
const
MetaTensor
&
y
,
const
MetaTensor
&
weight
,
const
MetaTensor
&
dout
,
MetaTensor
*
dx
,
MetaTensor
*
dy
,
MetaTensor
*
dweight
,
MetaTensor
*
dbias
)
{
void
BilinearGradInferMeta
(
const
MetaTensor
&
x
,
const
MetaTensor
&
y
,
const
MetaTensor
&
weight
,
const
MetaTensor
&
dout
,
MetaTensor
*
dx
,
MetaTensor
*
dy
,
MetaTensor
*
dweight
,
MetaTensor
*
dbias
)
{
auto
x_dims
=
x
.
dims
();
auto
y_dims
=
y
.
dims
();
auto
weight_dims
=
weight
.
dims
();
...
...
paddle/phi/infermeta/backward.h
浏览文件 @
eb93b5c9
...
...
@@ -36,14 +36,14 @@ void AngleGradInferMeta(const MetaTensor& x,
const
MetaTensor
&
out_grad
,
MetaTensor
*
x_grad
);
void
Bilinear
TensorProduct
GradInferMeta
(
const
MetaTensor
&
x
,
const
MetaTensor
&
y
,
const
MetaTensor
&
weight
,
const
MetaTensor
&
dout
,
MetaTensor
*
dx
,
MetaTensor
*
dy
,
MetaTensor
*
dweight
,
MetaTensor
*
dbias
);
void
BilinearGradInferMeta
(
const
MetaTensor
&
x
,
const
MetaTensor
&
y
,
const
MetaTensor
&
weight
,
const
MetaTensor
&
dout
,
MetaTensor
*
dx
,
MetaTensor
*
dy
,
MetaTensor
*
dweight
,
MetaTensor
*
dbias
);
void
BmmGradInferMeta
(
const
MetaTensor
&
x
,
const
MetaTensor
&
y
,
...
...
paddle/phi/kernels/cpu/slice_grad_kernel.cc
浏览文件 @
eb93b5c9
...
...
@@ -21,7 +21,7 @@
PD_REGISTER_KERNEL
(
slice_grad
,
CPU
,
ALL_LAYOUT
,
phi
::
SliceGrad
Raw
Kernel
,
phi
::
SliceGradKernel
,
bool
,
uint8_t
,
int
,
...
...
paddle/phi/kernels/gpu/slice_grad_kernel.cu.cc
浏览文件 @
eb93b5c9
...
...
@@ -21,7 +21,7 @@
PD_REGISTER_KERNEL
(
slice_grad
,
GPU
,
ALL_LAYOUT
,
phi
::
SliceGrad
Raw
Kernel
,
phi
::
SliceGradKernel
,
bool
,
uint8_t
,
int
,
...
...
paddle/phi/kernels/impl/slice_grad_kernel_impl.h
浏览文件 @
eb93b5c9
...
...
@@ -271,15 +271,15 @@ void SliceGradCompute(const Context& ctx,
}
template
<
typename
T
,
typename
Context
>
void
SliceGrad
Raw
Kernel
(
const
Context
&
ctx
,
const
DenseTensor
&
input
,
const
DenseTensor
&
out_grad
,
const
std
::
vector
<
int64_t
>&
axes
,
const
IntArray
&
starts_arr
,
const
IntArray
&
ends_arr
,
const
std
::
vector
<
int64_t
>&
infer_flags
,
const
std
::
vector
<
int64_t
>&
decrease_axis
,
DenseTensor
*
input_grad
)
{
void
SliceGradKernel
(
const
Context
&
ctx
,
const
DenseTensor
&
input
,
const
DenseTensor
&
out_grad
,
const
std
::
vector
<
int64_t
>&
axes
,
const
IntArray
&
starts_arr
,
const
IntArray
&
ends_arr
,
const
std
::
vector
<
int64_t
>&
infer_flags
,
const
std
::
vector
<
int64_t
>&
decrease_axis
,
DenseTensor
*
input_grad
)
{
size_t
rank
=
input
.
dims
().
size
();
auto
&
starts
=
starts_arr
.
GetData
();
...
...
paddle/phi/kernels/onednn/slice_grad_kernel.cc
浏览文件 @
eb93b5c9
...
...
@@ -20,15 +20,15 @@
namespace
phi
{
template
<
typename
T
,
typename
Context
>
void
SliceGrad
Raw
Kernel
(
const
Context
&
dev_ctx
,
const
DenseTensor
&
input
,
const
DenseTensor
&
out_grad
,
const
std
::
vector
<
int64_t
>&
axes
,
const
IntArray
&
starts
,
const
IntArray
&
ends
,
const
std
::
vector
<
int64_t
>&
infer_flags
,
const
std
::
vector
<
int64_t
>&
decrease_axis
,
DenseTensor
*
input_grad
)
{
void
SliceGradKernel
(
const
Context
&
dev_ctx
,
const
DenseTensor
&
input
,
const
DenseTensor
&
out_grad
,
const
std
::
vector
<
int64_t
>&
axes
,
const
IntArray
&
starts
,
const
IntArray
&
ends
,
const
std
::
vector
<
int64_t
>&
infer_flags
,
const
std
::
vector
<
int64_t
>&
decrease_axis
,
DenseTensor
*
input_grad
)
{
const
auto
&
onednn_engine
=
dev_ctx
.
GetEngine
();
auto
dx_dims
=
vectorize
(
input_grad
->
dims
());
...
...
@@ -81,6 +81,6 @@ void SliceGradRawKernel(const Context& dev_ctx,
PD_REGISTER_KERNEL
(
slice_grad
,
OneDNN
,
ONEDNN
,
phi
::
SliceGrad
Raw
Kernel
,
phi
::
SliceGradKernel
,
float
,
phi
::
dtype
::
bfloat16
)
{}
paddle/phi/kernels/slice_grad_kernel.h
浏览文件 @
eb93b5c9
...
...
@@ -21,15 +21,15 @@
namespace
phi
{
template
<
typename
T
,
typename
Context
>
void
SliceGrad
Raw
Kernel
(
const
Context
&
ctx
,
const
DenseTensor
&
input
,
const
DenseTensor
&
out_grad
,
const
std
::
vector
<
int64_t
>&
axes
,
const
IntArray
&
starts
,
const
IntArray
&
ends
,
const
std
::
vector
<
int64_t
>&
infer_flags
,
const
std
::
vector
<
int64_t
>&
decrease_axis
,
DenseTensor
*
input_grad
);
void
SliceGradKernel
(
const
Context
&
ctx
,
const
DenseTensor
&
input
,
const
DenseTensor
&
out_grad
,
const
std
::
vector
<
int64_t
>&
axes
,
const
IntArray
&
starts
,
const
IntArray
&
ends
,
const
std
::
vector
<
int64_t
>&
infer_flags
,
const
std
::
vector
<
int64_t
>&
decrease_axis
,
DenseTensor
*
input_grad
);
template
<
typename
T
,
typename
Context
>
void
SliceArrayGradKernel
(
const
Context
&
dev_ctx
,
...
...
paddle/phi/kernels/xpu/slice_grad_kernel.cc
浏览文件 @
eb93b5c9
...
...
@@ -21,15 +21,15 @@
namespace
phi
{
template
<
typename
T
,
typename
Context
>
void
SliceGrad
Raw
Kernel
(
const
Context
&
ctx
,
const
DenseTensor
&
input
,
const
DenseTensor
&
out_grad
,
const
std
::
vector
<
int64_t
>&
axes
,
const
IntArray
&
starts_t
,
const
IntArray
&
ends_t
,
const
std
::
vector
<
int64_t
>&
infer_flags
,
const
std
::
vector
<
int64_t
>&
decrease_axis
,
DenseTensor
*
input_grad
)
{
void
SliceGradKernel
(
const
Context
&
ctx
,
const
DenseTensor
&
input
,
const
DenseTensor
&
out_grad
,
const
std
::
vector
<
int64_t
>&
axes
,
const
IntArray
&
starts_t
,
const
IntArray
&
ends_t
,
const
std
::
vector
<
int64_t
>&
infer_flags
,
const
std
::
vector
<
int64_t
>&
decrease_axis
,
DenseTensor
*
input_grad
)
{
using
XPUType
=
typename
XPUTypeTrait
<
T
>::
Type
;
ctx
.
template
Alloc
<
T
>(
input_grad
);
...
...
@@ -82,7 +82,7 @@ void SliceGradRawKernel(const Context& ctx,
PD_REGISTER_KERNEL
(
slice_grad
,
XPU
,
ALL_LAYOUT
,
phi
::
SliceGrad
Raw
Kernel
,
phi
::
SliceGradKernel
,
float
,
int
,
phi
::
dtype
::
float16
)
{}
python/paddle/nn/functional/common.py
浏览文件 @
eb93b5c9
...
...
@@ -942,7 +942,7 @@ def bilinear(x1, x2, weight, bias=None, name=None):
"""
if
in_dygraph_mode
():
return
_C_ops
.
bilinear
_tensor_product
(
x1
,
x2
,
weight
,
bias
)
return
_C_ops
.
bilinear
(
x1
,
x2
,
weight
,
bias
)
else
:
check_variable_and_dtype
(
x1
,
'x1'
,
[
'float32'
,
'float64'
],
'bilinear'
)
check_variable_and_dtype
(
x2
,
'x2'
,
[
'float32'
,
'float64'
],
'bilinear'
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录