op.c.j2 1.2 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
{% from "operator_utils.c.j2" import op_maker, backward_op_maker, operator, register_op_with_components %}
// this file is generated by python/paddle/utils/code_gen/generate_op.py, do not edit.
#include <string>
#include "paddle/fluid/framework/infershape_utils.h"
#include "paddle/fluid/framework/op_registry.h"
#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"
#include "paddle/phi/infermeta/backward.cc"

namespace paddle {
namespace operators {

using paddle::framework::GradVarName;

{% for api in apis %}
  {% if api is base_api %}

{{op_maker(api)}}

{{operator(api)}}
  {% endif %}
{% endfor %}

{% for api in backward_apis %}
  {% if api is base_api %}

{{backward_op_maker(api, api_dict[api["forward"]["name"]])}}

{{operator(api)}}
  {% endif %}
{% endfor %}
}  // namespace operators
}  // namespace paddle

namespace ops = paddle::operators;
{% for api in apis + backward_apis %}
{% if api is base_api %}
{{register_op_with_components(api)}}
{% endif %}
{% endfor %}