Skip to content

Commit

Permalink
[static op generation] tril_triu (#54033)
Browse files Browse the repository at this point in the history
* [phi] autogen code tril_triu

* [phi][api]fix tril_triu_grad args

* [fluid] clean cmake; [phi] fix infer_meta
  • Loading branch information
gouzil authored May 23, 2023
1 parent adca365 commit 4af0f14
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 137 deletions.
103 changes: 0 additions & 103 deletions paddle/fluid/operators/tril_triu_op.cc

This file was deleted.

1 change: 0 additions & 1 deletion paddle/fluid/operators/unity_build_rule.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,6 @@ register_unity_group(
transpose_op.cc
mkldnn/transpose_mkldnn_op.cc
tree_conv_op.cc
tril_triu_op.cc
unbind_op.cc
unfold_op.cc)
register_unity_group(
Expand Down
7 changes: 7 additions & 0 deletions paddle/phi/api/yaml/op_compat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2390,6 +2390,13 @@
outputs :
out : Out

- op : tril_triu
backward : tril_triu_grad
inputs :
{x: X}
outputs :
{out : Out}

- op : trilinear_interp (trilinear_interp_v2)
backward : trilinear_interp_grad (trilinear_interp_v2_grad)
inputs :
Expand Down
10 changes: 10 additions & 0 deletions paddle/phi/api/yaml/static_backward.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,16 @@
func : softmax_grad
composite : softmax_grad(out, out_grad, axis, x_grad)

- backward_op : tril_triu_grad
forward : tril_triu (Tensor x, int diagonal = 0, bool lower = false) -> Tensor(out)
args : (Tensor out_grad, int diagonal, bool lower)
output : Tensor(x_grad)
infer_meta :
func : UnchangedInferMeta
param : [out_grad]
kernel:
func : tril_triu_grad

- backward_op: unpool_grad
forward: unpool (Tensor x, Tensor indices, int[] ksize, str unpooling_type, int[] strides = {1,1}, int[] paddings ={0,0} ,IntArray output_size = {0,0}, str data_format="NCHW") -> Tensor(out)
args: (Tensor x, Tensor indices, Tensor out, Tensor out_grad, int[] ksize, int[] strides, int[] paddings, IntArray output_size, str data_format)
Expand Down
9 changes: 9 additions & 0 deletions paddle/phi/api/yaml/static_ops.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,15 @@
param : [rows, cols, offset, dtype]
data_type : dtype

- op : tril_triu
args : (Tensor x, int diagonal = 0, bool lower = false)
output : Tensor(out)
infer_meta :
func : TrilTriuInferMeta
kernel :
func : tril_triu
backward : tril_triu_grad

- op : triu_indices
args : (int row = 0, int col = 0, int offset = 0, DataType dtype = DataType::INT64)
output : Tensor(out)
Expand Down
33 changes: 0 additions & 33 deletions paddle/phi/ops/compat/tril_triu_sig.cc

This file was deleted.

0 comments on commit 4af0f14

Please sign in to comment.