op.c.j2 1.4 KB
Newer Older
1
{% from "operator_utils.c.j2" import op_maker, backward_op_maker, backward_op_reused_maker, operator, register_op_with_components, register_op_version %}
2
// this file is generated by paddle/phi/api/yaml/generator/generate_op.py, do not edit.
3 4 5
#include <string>
#include "paddle/fluid/framework/infershape_utils.h"
#include "paddle/fluid/framework/op_registry.h"
6
#include "paddle/fluid/framework/op_version_registry.h"
7 8 9 10 11 12 13
#include "paddle/fluid/framework/convert_utils.h"
#include "paddle/phi/core/infermeta_utils.h"
#include "paddle/phi/infermeta/nullary.h"
#include "paddle/phi/infermeta/unary.h"
#include "paddle/phi/infermeta/binary.h"
#include "paddle/phi/infermeta/ternary.h"
#include "paddle/phi/infermeta/multiary.h"
14
#include "paddle/phi/infermeta/backward.h"
15 16 17 18 19 20

namespace paddle {
namespace operators {

using paddle::framework::GradVarName;

21 22
{% for op in ops %}
  {% if op is base_op %}
23

24
{{op_maker(op)}}
25

26
{{operator(op)}}
27 28 29
  {% endif %}
{% endfor %}

30 31
{% for op in backward_ops %}
  {% if op is base_op %}
32

33
{{backward_op_maker(op, op_dict[op["forward"]["name"]])}}
34

35
{{operator(op)}}
36
  {% else %}
37
{{backward_op_reused_maker(op, op_dict[op["forward"]["name"]], op["invoke"])}}
38 39 40 41 42 43
  {% endif %}
{% endfor %}
}  // namespace operators
}  // namespace paddle

namespace ops = paddle::operators;
44 45 46 47
{% for op in ops + backward_ops %}
{% if op is base_op %}
{{register_op_with_components(op)}}
{{register_op_version(op)}}
48 49
{% endif %}
{% endfor %}