Skip to content

Commit

Permalink
support auto generate for kldiv_loss (#51886)
Browse files Browse the repository at this point in the history
  • Loading branch information
enkilee authored Mar 28, 2023
1 parent a2d3c33 commit cdba7e3
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 202 deletions.
151 changes: 0 additions & 151 deletions paddle/fluid/operators/kldiv_loss_op.cc

This file was deleted.

11 changes: 11 additions & 0 deletions paddle/phi/api/yaml/backward.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -754,6 +754,17 @@
kernel :
func : inverse_grad

- backward_op : kldiv_loss_grad
forward : kldiv_loss(Tensor x, Tensor label, str reduction="mean") -> Tensor(out)
args : (Tensor x, Tensor label, Tensor out_grad, str reduction)
output : Tensor(x_grad)
infer_meta :
func : UnchangedInferMeta
param: [x]
kernel :
func : kldiv_loss_grad
no_need_buffer : x

- backward_op : kron_grad
forward : kron (Tensor x, Tensor y) -> Tensor(out)
args : (Tensor x, Tensor y, Tensor out_grad)
Expand Down
11 changes: 0 additions & 11 deletions paddle/phi/api/yaml/legacy_backward.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -577,17 +577,6 @@
optional : scale
backward : instance_norm_double_grad

- backward_op : kldiv_loss_grad
forward : kldiv_loss(Tensor x, Tensor label, str reduction) -> Tensor(out)
args : (Tensor x, Tensor label, Tensor out_grad, str reduction)
output : Tensor(x_grad)
infer_meta :
func : UnchangedInferMeta
param: [x]
kernel :
func : kldiv_loss_grad
no_need_buffer : x

- backward_op : layer_norm_grad
forward : layer_norm (Tensor x, Tensor scale, Tensor bias, float epsilon, int begin_norm_axis) -> Tensor(out), Tensor(mean), Tensor(variance)
args : (Tensor x, Tensor scale, Tensor bias, Tensor mean, Tensor variance, Tensor out_grad, float epsilon, int begin_norm_axis)
Expand Down
10 changes: 0 additions & 10 deletions paddle/phi/api/yaml/legacy_ops.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -825,16 +825,6 @@
intermediate : saved_mean, saved_variance
backward : instance_norm_grad

- op : kldiv_loss
args : (Tensor x, Tensor label, str reduction)
output : Tensor(out)
infer_meta :
func : KLDivInferMeta
kernel :
func : kldiv_loss
data_type : x
backward : kldiv_loss_grad

- op : layer_norm
args : (Tensor x, Tensor scale, Tensor bias, float epsilon, int begin_norm_axis)
output : Tensor(out), Tensor(mean), Tensor(variance)
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 @@ -990,6 +990,13 @@
outputs :
out : Out

- op : kldiv_loss
backward : kldiv_loss_grad
inputs :
{x : X, label : Target}
outputs :
out : Loss

- op : kron
backward : kron_grad
inputs :
Expand Down
10 changes: 10 additions & 0 deletions paddle/phi/api/yaml/ops.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -784,6 +784,16 @@
func : isnan {dense -> dense},
isnan_sr {selected_rows -> selected_rows}

- op : kldiv_loss
args : (Tensor x, Tensor label, str reduction = "mean")
output : Tensor(out)
infer_meta :
func : KLDivInferMeta
kernel :
func : kldiv_loss
data_type : x
backward : kldiv_loss_grad

- op : kron
args : (Tensor x, Tensor y)
output : Tensor
Expand Down
30 changes: 0 additions & 30 deletions paddle/phi/ops/compat/kldiv_loss_sig.cc

This file was deleted.

0 comments on commit cdba7e3

Please sign in to comment.