// Copyright (c) 2021 Graphcore Ltd. All rights reserved.
/**
 * THIS IS AN AUTOGENERATED FILE, DO NOT EDIT DIRECTLY!
 * The script to generate it is in `scripts/gen_op_bindings.py`.
 * The template to generate it is in
 * `python/popart._internal.ir/templates/op/op.cpp.j2`.
 */

#include "{{related_header}}"

#include <memory>
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>

#include <popart/graph.hpp>
#include <{{op_header}}>

namespace py = pybind11;

namespace popart {
namespace _internal {
namespace ir {
{%- for namespace in namespaces %}
namespace {{namespace}} {
{% endfor %}


void {{fun_name}}(py::module &m) {
      auto sm = m;
      {% for namespace in namespaces %}
      sm = sm.def_submodule("{{namespace}}", "Python bindings for PopART ops.");
      {% endfor %}

      {% for op in ops %}
      py::class_<{{op["name"]}}, popart::Op, std::shared_ptr<{{op["name"]}}>>(sm, "{{op["name"]}}")
      {%- for ctor in op["constructors"] -%}
      .def(py::init<{{ctor["full_args"]}}>(),
      {% for arg in ctor["args"] -%}
      py::arg("
            {%- if arg["arg_name"]|length > 0 -%}
            {{arg["arg_name"]}}
            {%- else -%}
            {{arg["alt_arg_name"]}}
            {%- endif -%}")
      {%- if not loop.last -%},{%- endif -%}
      {%- endfor -%}
      )
      {% endfor -%};
      {% endfor -%}
}

{% for namespace in namespaces %}
}
{% endfor -%}
}
}
}
