# Operators

## operation

struct migraphx::internal::operation

  The operation interface represents an action an instruction will perform. All operation classes must be CopyConstructible.

  Public Functions

  std::string name() const

    A unique name identifying the operation.

  void finalize(context &ctx)

    An optional method that can be used to finalize the operator before running.

  shape compute_shape(const std::vector<shape> &input) const

    This is used to compute the resulting shape from an operation. If an operation cannot be run with input shapes, then it should throw an exception.

  argument compute(context &ctx, const shape &output, const std::vector<argument> &input) const

    This performs the operation’s computation.

    This method can be optional when the operation is only used as a placeholder to be lowered later on.

    Parameters

      - ctx – This is the context created by the `target` during compilation. Implementations can use the target’s `context` class rather than the `context` interface class.

      - output – This is the output shape. It is equivalent to running `compute_shape` with each `shape` of the `argument`.

      - input – This is the `argument` result from the previous instruction’s computation.

    Returns

      Return an `argument` of the result computation. The `shape` of `argument` should be the same the `output` shape.

  std::ptrdiff_t output_alias(const std::vector<shape> &input) const

    An optional method to return which argument the output will alias. If there is no aliased output then -1 can be returned.

  Friends

  friend friend std::ostream & operator<< (std::ostream &os, const operation &op)

    An optional stream operator to print the operation. When this is not implemented, it will just print the operation’s name.

bool migraphx::internal::is_context_free(const operation &x)

  Returns true if operation does not require a context to run compute.

bool migraphx::internal::has_finalize(const operation &x)

  Returns true if the operation has a finalize method.

## operators

namespace migraphx::internal::op

  Enums

  enum padding_mode_t

    Values:

    enumerator default_
    enumerator same
    enumerator valid
  enum rnn_direction

    Values:

    enumerator forward
    enumerator reverse
    enumerator bidirectional
  enum normalize_attribute

    Values:

    enumerator use_len
    enumerator use_output
    enumerator clip_max
    enumerator clip_min
    enumerator include_max
    enumerator include_min
    enumerator normalize_padding

  Functions

  std::ostream &operator<<(std::ostream &os, rnn_direction v)
  struct abs : public migraphx::internal::op::unary<abs>
    #include <migraphx/op/abs.hpp>

    Public Functions

    inline auto apply() const
  struct acos : public migraphx::internal::op::unary<acos>
    #include <migraphx/op/acos.hpp>

    Public Functions

    inline auto apply() const
  struct acosh : public migraphx::internal::op::unary<acosh>
    #include <migraphx/op/acosh.hpp>

    Public Functions

    inline auto apply() const
  struct add : public migraphx::internal::op::binary<add>
    #include <migraphx/op/add.hpp>

    Public Functions

    inline value attributes() const
    inline std::string point_function() const
    inline auto apply() const
  struct argmax
    #include <migraphx/op/argmax.hpp>

    Public Functions

    inline value attributes() const
    inline std::string name() const
    inline shape normalize_compute_shape(std::vector<shape> inputs) const
    template<class T>
    inline int64_t calc_argmax(T &input, std::vector<std::size_t> &indices, size_t item_num) const
    inline argument compute(const shape &output_shape, std::vector<argument> args) const

    Public Members

    int64_t axis = 0

    Public Static Functions

    template<class Self, class F>
    static inline auto reflect(Self &self, F f)
  struct argmin
    #include <migraphx/op/argmin.hpp>

    Public Functions

    inline value attributes() const
    inline std::string name() const
    inline shape normalize_compute_shape(std::vector<shape> inputs) const
    template<class T>
    inline int64_t calc_argmin(T &input, std::vector<std::size_t> &indices, size_t item_num) const
    inline argument compute(const shape &output_shape, std::vector<argument> args) const

    Public Members

    int64_t axis = 0

    Public Static Functions

    template<class Self, class F>
    static inline auto reflect(Self &self, F f)
  struct as_shape
    #include <migraphx/op/as_shape.hpp>

    Public Functions

    inline std::string name() const
    inline shape compute_shape(const std::vector<shape> &inputs) const
    inline argument compute(shape output_shape, std::vector<argument> args) const
    inline lifetime get_lifetime() const
    inline std::ptrdiff_t output_alias(const std::vector<shape>&) const

    Public Members

    shape s

    Public Static Functions

    template<class Self, class F>
    static inline auto reflect(Self &self, F f)
  struct asin : public migraphx::internal::op::unary<asin>
    #include <migraphx/op/asin.hpp>

    Public Functions

    inline auto apply() const
  struct asinh : public migraphx::internal::op::unary<asinh>
    #include <migraphx/op/asinh.hpp>

    Public Functions

    inline auto apply() const
  struct atan : public migraphx::internal::op::unary<atan>
    #include <migraphx/op/atan.hpp>

    Public Functions

    inline auto apply() const
  struct atanh : public migraphx::internal::op::unary<atanh>
    #include <migraphx/op/atanh.hpp>

    Public Functions

    inline auto apply() const
  struct batch_norm_inference
    #include <migraphx/op/batch_norm_inference.hpp>

    Public Types

    enum bn_infer_mode_t

      Values:

      enumerator per_activation
      enumerator spatial

    Public Functions

    inline std::string name() const
    inline shape compute_shape(std::vector<shape> inputs) const

    Public Members

    float epsilon = 1.0e-6f
    float momentum = 0.9f
    bn_infer_mode_t bn_mode = spatial

    Public Static Functions

    template<class Self, class F>
    static inline auto reflect(Self &self, F f)
  template<class Derived>
  struct binary : public migraphx::internal::op::op_name<Derived>
    #include <migraphx/op/binary.hpp>

    Public Functions

    inline std::string point_function() const
    inline std::string point_op() const
    inline value base_attributes() const
    inline value attributes() const
    inline shape compute_shape(std::vector<shape> inputs) const
    inline argument compute(const shape &output_shape, std::vector<argument> args) const
  struct broadcast
    #include <migraphx/op/broadcast.hpp>

    The broadcast operator performs the numpy-style broadcasting of an axis of a given tensor. This is achieved primarily by setting the stride of the broadcasted axis to zero. Linear indicies are computed from multi-indicies by computing the inner product on the multi-index with the strides. For example, if we have a tensor A(2,3) it has lengths of (2,3) and strides of (3,1). If we want to compute the linear offset that corresponds to the element on the 2nd row (i = 1) and 3rd column (j = 2), we compute the following inner product (1,2) dot (3, 1) = 1*3 + 2*1 = 5. It is obvious from there that we can negate the effects of a given axis by setting the stride of that axis to zero.

    Public Functions

    inline std::string name() const
    inline shape compute_shape(std::vector<shape> inputs) const
    inline argument compute(shape output_shape, std::vector<argument> args) const
    inline lifetime get_lifetime() const
    inline std::ptrdiff_t output_alias(const std::vector<shape>&) const

    Public Members

    uint64_t axis = 0
    std::vector<std::size_t> broadcast_lens

    Public Static Functions

    template<class Self, class F>
    static inline auto reflect(Self &self, F f)
  struct capture
    #include <migraphx/op/capture.hpp>

    Public Functions

    inline std::string name() const
    inline shape compute_shape(std::vector<shape> inputs) const
    inline argument compute(context&, const shape&, const std::vector<argument> &args) const
    inline std::ptrdiff_t output_alias(const std::vector<shape>&) const

    Public Members

    std::size_t ins_index
    std::function<void(std::size_t ins_index, std::vector<argument>)> f = {}

    Public Static Functions

    template<class Self, class F>
    static inline auto reflect(Self &self, F f)
  struct ceil : public migraphx::internal::op::unary<ceil>
    #include <migraphx/op/ceil.hpp>

    Public Functions

    inline auto apply() const
  struct clip
    #include <migraphx/op/clip.hpp>

    Public Functions

    inline std::string name() const
    inline value attributes() const
    inline shape compute_shape(std::vector<shape> inputs) const
    inline argument compute(const shape &output_shape, std::vector<argument> args) const
  struct concat
    #include <migraphx/op/concat.hpp>

    Public Functions

    inline value attributes() const
    inline std::string name() const
    inline std::vector<std::size_t> compute_offsets(const shape &output_shape, const std::vector<argument> &args) const
    inline shape normalize_compute_shape(std::vector<shape> inputs) const
    inline argument compute(const shape &output_shape, std::vector<argument> args) const

    Public Members

    int64_t axis = 0

    Public Static Functions

    template<class Self, class F>
    static inline auto reflect(Self &self, F f)
  struct contiguous
    #include <migraphx/op/contiguous.hpp>

    The contiguous operator takes a non-standard input tensor and returns the same tensor but in standard form. For example, if input tensor A which has lens = (4,5) is first transposed, i.e. lens = (5,4), this tensor’s data layout remained the same during the transpose operation; only it’s shape lengths and strides were changed. This leaves the tensor in a non-standard form. The contiguous operator copies the underlying data such that resulting tensor is returned to a standard form.

    Public Functions

    inline std::string name() const
    inline shape compute_shape(std::vector<shape> inputs) const
    inline argument compute(const shape &output_shape, std::vector<argument> args) const
    inline auto apply() const
  struct convert : public migraphx::internal::op::unary<convert>
    #include <migraphx/op/convert.hpp>

    Public Functions

    inline shape compute_shape(std::vector<shape> inputs) const
    inline std::string point_op() const
    inline auto apply() const
    inline convert(shape::type_t t)
    inline convert()

    Public Members

    shape::type_t target_type = shape::half_type

    Public Static Functions

    template<class Self, class F>
    static inline auto reflect(Self &self, F f)
  struct convolution
    #include <migraphx/op/convolution.hpp>

    Public Functions

    inline std::string name() const
    inline void check_attribute_size() const
    inline value attributes() const
    inline shape normalize_compute_shape(std::vector<shape> inputs) const
    inline size_t kdims() const

    Public Members

    std::vector<std::size_t> padding = {0, 0}
    std::vector<std::size_t> stride = {1, 1}
    std::vector<std::size_t> dilation = {1, 1}
    int group = 1
    padding_mode_t padding_mode = default_

    Public Static Functions

    template<class Self, class F>
    static inline auto reflect(Self &self, F f)
  struct cos : public migraphx::internal::op::unary<cos>
    #include <migraphx/op/cos.hpp>

    Public Functions

    inline auto apply() const
  struct cosh : public migraphx::internal::op::unary<cosh>
    #include <migraphx/op/cosh.hpp>

    Public Functions

    inline auto apply() const
  struct deconvolution
    #include <migraphx/op/deconvolution.hpp>

    Public Functions

    inline std::string name() const
    inline void check_attribute_size() const
    inline shape compute_shape(std::vector<shape> inputs) const
    inline argument compute(shape output_shape, std::vector<argument> args) const
    inline size_t kdims() const

    Public Members

    std::vector<std::size_t> padding = {0, 0}
    std::vector<std::size_t> stride = {1, 1}
    std::vector<std::size_t> dilation = {1, 1}
    padding_mode_t padding_mode = default_
    int group = 1

    Public Static Functions

    template<class Self, class F>
    static inline auto reflect(Self &self, F f)
  struct dequantizelinear
    #include <migraphx/op/dequantizelinear.hpp>

    Public Functions

    inline std::string name() const
    inline shape compute_shape(std::vector<shape> inputs) const
    inline argument compute(const shape &output_shape, std::vector<argument> args) const
  struct div : public migraphx::internal::op::binary<div>
    #include <migraphx/op/div.hpp>

    Public Functions

    inline std::string point_function() const
    inline auto apply() const
  struct dot
    #include <migraphx/op/dot.hpp>

    Public Functions

    inline std::string name() const
    inline shape compute_shape(std::vector<shape> inputs) const
    inline argument compute(shape output_shape, std::vector<argument> args) const
  struct elu
    #include <migraphx/op/elu.hpp>

    Public Functions

    inline std::string name() const
    inline shape compute_shape(std::vector<shape> inputs) const

    Public Members

    float alpha = 1

    Public Static Functions

    template<class Self, class F>
    static inline auto reflect(Self &self, F f)
  struct equal : public migraphx::internal::op::binary<equal>
    #include <migraphx/op/equal.hpp>

    Public Functions

    inline value attributes() const
    inline std::string point_function() const
    inline auto apply() const
  struct erf : public migraphx::internal::op::unary<erf>
    #include <migraphx/op/erf.hpp>

    Public Functions

    inline auto apply() const
  struct exp : public migraphx::internal::op::unary<exp>
    #include <migraphx/op/exp.hpp>

    Public Functions

    inline auto apply() const
  struct flatten
    #include <migraphx/op/flatten.hpp>

    Public Functions

    inline value attributes() const
    inline std::string name() const
    inline shape normalize_compute_shape(std::vector<shape> inputs) const
    inline argument compute(shape output_shape, std::vector<argument> args) const
    inline lifetime get_lifetime() const
    inline std::ptrdiff_t output_alias(const std::vector<shape>&) const

    Public Members

    int64_t axis = 1

    Public Static Functions

    template<class Self, class F>
    static inline auto reflect(Self &self, F f)
  struct floor : public migraphx::internal::op::unary<floor>
    #include <migraphx/op/floor.hpp>

    Public Functions

    inline auto apply() const
  struct gather
    #include <migraphx/op/gather.hpp>

    Public Functions

    inline value attributes() const
    inline std::string name() const
    inline shape normalize_compute_shape(std::vector<shape> inputs) const
    inline argument compute(const shape &output_shape, std::vector<argument> args) const

    Public Members

    int64_t axis = 0

    Public Static Functions

    template<class Self, class F>
    static inline auto reflect(Self &self, F f)
  struct get_tuple_elem
    #include <migraphx/op/get_tuple_elem.hpp>

    Public Functions

    inline std::string name() const
    inline shape compute_shape(std::vector<shape> inputs) const
    inline argument compute(const shape&, std::vector<argument> args) const
    inline std::ptrdiff_t output_alias(const std::vector<shape>&) const

    Public Members

    std::size_t index = 0

    Public Static Functions

    template<class Self, class F>
    static inline auto reflect(Self &self, F f)
  struct greater : public migraphx::internal::op::binary<greater>
    #include <migraphx/op/greater.hpp>

    Public Functions

    inline std::string point_function() const
    inline auto apply() const
  struct gru
    #include <migraphx/op/gru.hpp>

    Public Functions

    inline std::string name() const
    inline shape compute_shape(std::vector<shape> inputs) const

    Public Members

    std::size_t hidden_size = 1
    std::vector<operation> actv_funcs = {sigmoid{}, tanh{}}
    rnn_direction direction = rnn_direction::forward
    float clip = 0.0f
    int linear_before_reset = 0

    Public Static Functions

    template<class Self, class F>
    static inline auto reflect(Self &self, F f)
  struct highest
    #include <migraphx/op/reduce_op.hpp>

    Public Functions

    template<class T>
    inline operator T() const
  struct identity
    #include <migraphx/op/identity.hpp>

    Public Functions

    inline std::string name() const
    inline shape compute_shape(std::vector<shape> inputs) const
    inline argument compute(shape, std::vector<argument> args) const
    inline std::ptrdiff_t output_alias(const std::vector<shape>&) const
  struct if_op
    #include <migraphx/op/if_op.hpp>

    Public Functions

    inline std::string name() const
    inline shape compute_shape(const std::vector<shape> &inputs, std::vector<module_ref> mods) const
    inline argument compute(const shape&, const std::vector<argument> &args, const std::vector<module_ref> &mods, const std::function<std::vector<argument>(module_ref&, const std::unordered_map<std::string, argument>&)> &run) const
  struct im2col
    #include <migraphx/op/im2col.hpp>

    Public Functions

    inline std::string name() const
    inline value attributes() const
    inline shape normalize_compute_shape(std::vector<shape> inputs) const

    Public Members

    std::vector<std::size_t> padding = {0, 0}
    std::vector<std::size_t> stride = {1, 1}
    std::vector<std::size_t> dilation = {1, 1}
    padding_mode_t padding_mode = default_

    Public Static Functions

    template<class Self, class F>
    static inline auto reflect(Self &self, F f)
  struct leaky_relu
    #include <migraphx/op/leaky_relu.hpp>

    Public Functions

    inline std::string name() const
    inline shape compute_shape(std::vector<shape> inputs) const

    Public Members

    float alpha = 0.01

    Public Static Functions

    template<class Self, class F>
    static inline auto reflect(Self &self, F f)
  struct less : public migraphx::internal::op::binary<less>
    #include <migraphx/op/less.hpp>

    Public Functions

    inline std::string point_function() const
    inline auto apply() const
  struct load
    #include <migraphx/op/load.hpp>

    Public Functions

    inline std::string name() const
    inline shape compute_shape(const std::vector<shape> &inputs) const
    inline argument compute(const shape&, const std::vector<argument> &args) const
    inline lifetime get_lifetime() const
    inline std::ptrdiff_t output_alias(const std::vector<shape>&) const

    Public Members

    shape s
    std::size_t offset = 0

    Public Static Functions

    template<class Self, class F>
    static inline auto reflect(Self &self, F f)

    Friends

    inline friend friend std::ostream & operator<< (std::ostream &os, const load &op)
  struct log : public migraphx::internal::op::unary<log>
    #include <migraphx/op/log.hpp>

    Public Functions

    inline auto apply() const
  struct logical_and : public migraphx::internal::op::binary<logical_and>
    #include <migraphx/op/logical_and.hpp>

    Public Functions

    inline std::string point_function() const
    inline auto apply() const
  struct logical_or : public migraphx::internal::op::binary<logical_or>
    #include <migraphx/op/logical_or.hpp>

    Public Functions

    inline std::string point_function() const
    inline auto apply() const
  struct logical_xor : public migraphx::internal::op::binary<logical_xor>
    #include <migraphx/op/logical_xor.hpp>

    Public Functions

    inline std::string point_function() const
    inline auto apply() const
  struct logsoftmax
    #include <migraphx/op/logsoftmax.hpp>

    Public Functions

    inline value attributes() const
    inline std::string name() const
    inline shape normalize_compute_shape(std::vector<shape> inputs) const
    inline auto output() const

    Public Members

    int64_t axis = 1

    Public Static Functions

    template<class Self, class F>
    static inline auto reflect(Self &self, F f)
  struct loop
    #include <migraphx/op/loop.hpp>

    Public Functions

    inline std::string name() const
    inline shape compute_shape(const std::vector<shape> &inputs, std::vector<module_ref> mods) const
    inline argument compute(context &ctx, const shape &out_shape, const std::vector<argument> &args, const std::vector<module_ref> &mods, const std::function<std::vector<argument>(module_ref&, const std::unordered_map<std::string, argument>&)> &run) const

    Public Members

    int64_t max_iterations = 10

    Public Static Functions

    template<class Self, class F>
    static inline auto reflect(Self &self, F f)
    struct ref_loop
      #include <migraphx/op/loop.hpp>

      Public Functions

      template<class T>
      inline void copy(context&, const argument &src, T &dst) const
      template<class T>
      inline void copy(context&, T src, const argument &dst) const
      inline void append(const std::vector<argument> &iter_state, const std::vector<argument> &concatenated_outputs, int iter) const
      inline void set_zero(context&, const std::vector<argument> &concatenated_outputs, int iter) const
      inline std::unordered_map<std::string, int> get_output_params(const module&) const

      Public Members

      int64_t max_iterations = 0
  struct lowest
    #include <migraphx/op/reduce_op.hpp>

    Public Functions

    template<class T>
    inline operator T() const
  struct lrn
    #include <migraphx/op/lrn.hpp>

    Public Functions

    inline std::string name() const
    inline shape compute_shape(std::vector<shape> inputs) const

    Public Members

    float alpha = 0.0001
    float beta = 0.75
    float bias = 1.0
    int size = 1

    Public Static Functions

    template<class Self, class F>
    static inline auto reflect(Self &self, F f)
  struct lstm
    #include <migraphx/op/lstm.hpp>

    Public Functions

    inline std::string name() const
    inline shape compute_shape(std::vector<shape> inputs) const

    Public Members

    std::size_t hidden_size = 1
    std::vector<operation> actv_funcs = {sigmoid{}, tanh{}, tanh{}}
    rnn_direction direction = rnn_direction::forward
    float clip = 0.0f
    int input_forget = 0

    Public Static Functions

    template<class Self, class F>
    static inline auto reflect(Self &self, F f)
  struct max : public migraphx::internal::op::binary<max>
    #include <migraphx/op/max.hpp>

    Public Functions

    inline value attributes() const
    inline auto apply() const
  struct min : public migraphx::internal::op::binary<min>
    #include <migraphx/op/min.hpp>

    Public Functions

    inline value attributes() const
    inline auto apply() const
  struct mul : public migraphx::internal::op::binary<mul>
    #include <migraphx/op/mul.hpp>

    Public Functions

    inline value attributes() const
    inline std::string point_function() const
    inline auto apply() const
  struct multibroadcast
    #include <migraphx/op/multibroadcast.hpp>

    Public Functions

    inline std::string name() const
    inline shape compute_shape(std::vector<shape> inputs) const
    inline argument compute(shape output_shape, std::vector<argument> args) const
    inline lifetime get_lifetime() const
    inline std::ptrdiff_t output_alias(const std::vector<shape>&) const

    Public Members

    std::vector<std::size_t> output_lens

    Public Static Functions

    template<class Self, class F>
    static inline auto reflect(Self &self, F f)
  struct multinomial
    #include <migraphx/op/multinomial.hpp>

    Public Functions

    inline std::string name() const
    inline shape compute_shape(std::vector<shape> inputs) const
    inline argument compute(const shape &output_shape, std::vector<argument> args) const

    Public Members

    shape::type_t dtype = shape::type_t::int32_type

    Public Static Functions

    template<class Self, class F>
    static inline auto reflect(Self &self, F f)
  struct neg : public migraphx::internal::op::unary<neg>
    #include <migraphx/op/neg.hpp>

    Public Functions

    inline std::string point_function() const
    inline auto apply() const
  struct nonmaxsuppression
    #include <migraphx/op/nonmaxsuppression.hpp>

    Public Functions

    inline std::string name() const
    inline shape compute_shape(std::vector<shape> inputs) const
    template<class T>
    inline box batch_box(const T *boxes, std::size_t bidx) const
    inline bool suppress_by_iou(box b1, box b2, float iou_threshold) const
    inline argument compute(const shape &output_shape, std::vector<argument> args) const

    Public Members

    bool center_point_box = false

    Public Static Functions

    template<class Self, class F>
    static inline auto reflect(Self &self, F f)
    struct box
      #include <migraphx/op/nonmaxsuppression.hpp>

      Public Functions

      inline void sort()
      inline std::array<float, 2> &operator[](std::size_t i)
      inline float area() const

      Public Members

      std::array<float, 2> x
      std::array<float, 2> y
  struct nonzero
    #include <migraphx/op/nonzero.hpp>

    Public Functions

    inline std::string name() const
    inline shape compute_shape(std::vector<shape> inputs) const
    inline argument compute(const shape &output_shape, std::vector<argument> args) const
  struct one
    #include <migraphx/op/reduce_op.hpp>

    Public Functions

    template<class T>
    inline operator T() const
  template<class Derived>
  struct op_name
    #include <migraphx/op/name.hpp>

    Create name from class.

    Subclassed by migraphx::internal::op::binary< Derived >, migraphx::internal::op::prefix_scan_op< Derived >, migraphx::internal::op::reduce_op< Derived >, migraphx::internal::op::unary< Derived >

    Public Functions

    inline std::string name() const
  struct outline
    #include <migraphx/op/outline.hpp>

    Public Functions

    inline std::string name() const
    inline shape compute_shape(const std::vector<shape> &inputs) const
    inline argument compute(const shape&, const std::vector<argument>&) const

    Public Members

    shape s

    Public Static Functions

    template<class Self, class F>
    static inline auto reflect(Self &self, F f)
  struct pad
    #include <migraphx/op/pad.hpp>

    Public Types

    enum pad_op_mode_t

      Values:

      enumerator constant_pad
      enumerator reflect_pad
      enumerator edge_pad

    Public Functions

    inline std::string name() const
    inline shape compute_shape(std::vector<shape> inputs) const
    inline std::size_t pad_ndims() const
    inline bool symmetric() const

    Public Members

    std::vector<int64_t> pads
    float value = 0.0f
    pad_op_mode_t mode = constant_pad

    Public Static Functions

    template<class Self, class F>
    static inline auto reflect(Self &self, F f)
  struct pointwise
    #include <migraphx/op/pointwise.hpp>

    Public Functions

    inline std::string name() const
    inline shape compute_shape(const std::vector<shape> &inputs, std::vector<module_ref> mods) const
    inline argument compute(const shape &output_shape, const std::vector<argument> &args, const std::vector<module_ref> &mods, const std::function<std::vector<argument>(module_ref&, const std::unordered_map<std::string, argument>&)> &run) const
  struct pooling
    #include <migraphx/op/pooling.hpp>

    Public Functions

    inline std::string name() const
    inline void check_attribute_size() const
    inline value attributes() const
    inline shape normalize_compute_shape(std::vector<shape> inputs) const
    inline size_t kdims() const

    Public Members

    std::string mode = "average"
    std::vector<std::size_t> padding = {0, 0}
    std::vector<std::size_t> stride = {1, 1}
    std::vector<std::size_t> lengths = {1, 1}
    bool ceil_mode = false

    Public Static Functions

    template<class Self, class F>
    static inline auto reflect(Self &self, F f)
  struct pow : public migraphx::internal::op::binary<pow>
    #include <migraphx/op/pow.hpp>

    Public Functions

    inline auto apply() const
  template<class Derived>
  struct prefix_scan_op : public migraphx::internal::op::op_name<Derived>
    #include <migraphx/op/prefix_scan_op.hpp>

    Public Functions

    inline value attributes() const
    inline shape normalize_compute_shape(std::vector<shape> inputs) const
    inline argument compute(const shape&, std::vector<argument> args) const
    inline auto init() const
    inline prefix_scan_op()
    inline prefix_scan_op(int64_t ax)
    inline prefix_scan_op(int64_t ax, bool excl)
    inline prefix_scan_op(int64_t ax, bool excl, bool rev)

    Public Members

    int64_t axis
    bool exclusive = false
    bool reverse = false

    Public Static Functions

    template<class Self, class F>
    static inline auto reflect(Self &self, F f)
  struct prefix_scan_sum : public migraphx::internal::op::prefix_scan_op<prefix_scan_sum>
    #include <migraphx/op/prefix_scan_sum.hpp>

    Public Functions

    inline prefix_scan_sum()
    inline prefix_scan_sum(int64_t ax)
    inline prefix_scan_sum(int64_t ax, bool excl)
    inline prefix_scan_sum(int64_t ax, bool excl, bool rev)
    inline auto op() const
  struct prelu : public migraphx::internal::op::binary<prelu>
    #include <migraphx/op/prelu.hpp>

    Public Functions

    inline std::string point_op() const
    inline auto apply() const
  struct quant_convolution
    #include <migraphx/op/quant_convolution.hpp>

    Public Functions

    inline value attributes() const
    inline std::string name() const
    inline void check_attribute_size() const
    inline shape normalize_compute_shape(std::vector<shape> inputs) const
    inline size_t kdims() const

    Public Members

    std::vector<std::size_t> padding = {0, 0}
    std::vector<std::size_t> stride = {1, 1}
    std::vector<std::size_t> dilation = {1, 1}
    padding_mode_t padding_mode = default_
    int group = 1

    Public Static Functions

    template<class Self, class F>
    static inline auto reflect(Self &self, F f)
  struct quant_dot
    #include <migraphx/op/quant_dot.hpp>

    Public Functions

    inline value attributes() const
    inline std::string name() const
    inline shape compute_shape(std::vector<shape> inputs) const
  struct quantizelinear
    #include <migraphx/op/quantizelinear.hpp>

    Public Functions

    inline std::string name() const
    inline shape compute_shape(std::vector<shape> inputs) const
    inline argument compute(const shape &output_shape, std::vector<argument> args) const
  struct recip : public migraphx::internal::op::unary<recip>
    #include <migraphx/op/recip.hpp>

    Public Functions

    inline std::string point_op() const
    inline auto apply() const
  struct reduce_max : public migraphx::internal::op::reduce_op<reduce_max>
    #include <migraphx/op/reduce_max.hpp>

    Public Functions

    inline reduce_max()
    inline reduce_max(std::vector<int64_t> ax)
    inline auto op() const
    inline auto init() const
  struct reduce_mean : public migraphx::internal::op::reduce_op<reduce_mean>
    #include <migraphx/op/reduce_mean.hpp>

    Public Functions

    inline reduce_mean()
    inline reduce_mean(std::vector<int64_t> ax)
    inline auto op() const
    inline auto output(const shape &s) const
  struct reduce_min : public migraphx::internal::op::reduce_op<reduce_min>
    #include <migraphx/op/reduce_min.hpp>

    Public Functions

    inline reduce_min()
    inline reduce_min(std::vector<int64_t> ax)
    inline auto op() const
    inline auto init() const
  template<class Derived>
  struct reduce_op : public migraphx::internal::op::op_name<Derived>
    #include <migraphx/op/reduce_op.hpp>

    Public Functions

    inline value attributes() const
    inline std::vector<int64_t> tune_axes(std::size_t n_dim) const
    inline shape normalize_compute_shape(std::vector<shape> inputs) const
    template<class T>
    inline void tune_dims(const std::vector<int64_t> &tuned_axes, const std::vector<T> &in_lens, std::vector<T> &out_lens) const
    template<class T>
    inline void reduce(tensor_view<T> &input, shape &batch_shape, std::vector<int64_t> &tuned_axes, std::vector<std::size_t> &out_idx, tensor_view<T> &output) const
    inline argument compute(const shape &output_shape, std::vector<argument> args) const
    inline auto init() const
    inline auto input() const
    inline auto output(const shape&) const
    inline reduce_op()
    inline reduce_op(std::vector<int64_t> ax)

    Public Members

    std::vector<std::int64_t> axes = {}

    Public Static Functions

    template<class Self, class F>
    static inline auto reflect(Self &self, F f)
  struct reduce_prod : public migraphx::internal::op::reduce_op<reduce_prod>
    #include <migraphx/op/reduce_prod.hpp>

    Public Functions

    inline reduce_prod()
    inline reduce_prod(std::vector<int64_t> ax)
    inline auto op() const
    inline auto init() const
  struct reduce_sum : public migraphx::internal::op::reduce_op<reduce_sum>
    #include <migraphx/op/reduce_sum.hpp>

    Public Functions

    inline reduce_sum()
    inline reduce_sum(std::vector<int64_t> ax)
    inline auto op() const
  struct relu : public migraphx::internal::op::unary<relu>
    #include <migraphx/op/relu.hpp>

    Public Functions

    inline std::string point_op() const
    inline auto apply() const
  struct reshape
    #include <migraphx/op/reshape.hpp>

    Public Functions

    inline value attributes() const
    inline std::string name() const
    inline shape compute_shape(std::vector<shape> inputs) const
    inline argument compute(shape output_shape, std::vector<argument> args) const
    inline lifetime get_lifetime() const
    inline std::ptrdiff_t output_alias(const std::vector<shape>&) const

    Public Members

    std::vector<int64_t> dims

    Public Static Functions

    template<class Self, class F>
    static inline auto reflect(Self &self, F f)
  struct reverse
    #include <migraphx/op/reverse.hpp>

    Public Functions

    inline std::string name() const
    inline value attributes() const
    inline shape normalize_compute_shape(std::vector<shape> inputs) const
    inline argument compute(const shape &s, std::vector<argument> args) const

    Public Members

    std::vector<int64_t> axes

    Public Static Functions

    template<class Self, class F>
    static inline auto reflect(Self &self, F f)
  struct rnn
    #include <migraphx/op/rnn.hpp>

    Public Functions

    inline std::string name() const
    inline shape compute_shape(std::vector<shape> inputs) const

    Public Members

    std::size_t hidden_size = 1
    std::vector<operation> actv_funcs = {tanh{}, tanh{}}
    rnn_direction direction = rnn_direction::forward
    float clip = 0.0f

    Public Static Functions

    template<class Self, class F>
    static inline auto reflect(Self &self, F f)
  struct rnn_last_cell_output
    #include <migraphx/op/rnn_last_cell_output.hpp>

    Public Functions

    inline std::string name() const
    inline shape compute_shape(std::vector<shape> inputs) const
  struct rnn_last_hs_output
    #include <migraphx/op/rnn_last_hs_output.hpp>

    Public Functions

    inline std::string name() const
    inline shape compute_shape(std::vector<shape> inputs) const
  struct rnn_var_sl_last_output
    #include <migraphx/op/rnn_var_sl_last_output.hpp>

    Public Functions

    inline std::string name() const
    inline shape compute_shape(std::vector<shape> inputs) const

    Public Members

    rnn_direction direction = rnn_direction::forward

    Public Static Functions

    template<class Self, class F>
    static inline auto reflect(Self &self, F f)
  struct rnn_var_sl_shift_output
    #include <migraphx/op/rnn_variable_seq_lens.hpp>

    Public Functions

    inline std::string name() const
    inline shape compute_shape(std::vector<shape> inputs) const
    inline argument compute(const shape &output_shape, std::vector<argument> args) const

    Public Members

    std::string output_name = "hidden_states"
    rnn_direction direction = rnn_direction::forward

    Public Static Functions

    template<class Self, class F>
    static inline auto reflect(Self &self, F f)
  struct rnn_var_sl_shift_sequence
    #include <migraphx/op/rnn_variable_seq_lens.hpp>

    Public Functions

    inline std::string name() const
    inline shape compute_shape(std::vector<shape> inputs) const
    inline argument compute(const shape &output_shape, std::vector<argument> args) const
  struct roialign
    #include <migraphx/op/roialign.hpp>

    Public Functions

    inline std::string name() const
    inline shape compute_shape(std::vector<shape> inputs) const
    inline auto calc_pos_weight(const std::array<std::size_t, 2> &dims, const shape &comp_s, const std::array<float, 2> &roi_start, const std::array<float, 2> &bin_size, const std::array<std::size_t, 2> &bin_grid_size) const
    template<class T, class Op>
    inline std::tuple<double, int64_t> calc_pooling(const T &data, const std::array<std::size_t, 2> &bin_grid_size, const std::vector<pos_weight> &pos_weights, int64_t index, Op op) const
    inline argument compute(const shape &output_shape, std::vector<argument> args) const

    Public Members

    std::string coord_trans_mode = "half_pixel"
    std::string mode = "avg"
    int64_t output_height = 1
    int64_t output_width = 1
    int64_t sampling_ratio = 0
    float spatial_scale = 1.0f

    Public Static Functions

    template<class Self, class F>
    static inline auto reflect(Self &self, F f)
    struct avg_pool
      #include <migraphx/op/roialign.hpp>

      Public Functions

      inline double init()
      inline double operator()(double x, double y)
      inline double final(double x, std::size_t y)
    struct max_pool
      #include <migraphx/op/roialign.hpp>

      Public Functions

      inline double init()
      inline double operator()(double x, double y)
      inline double final(double x, std::size_t)
    struct pos_weight
      #include <migraphx/op/roialign.hpp>

      Public Members

      std::array<std::size_t, 4> pos = {0, 0, 0, 0}
      std::array<float, 4> w = {0.0f, 0.0f, 0.0f, 0.0f}
  struct round : public migraphx::internal::op::unary<round>
    #include <migraphx/op/round.hpp>

    Public Functions

    inline auto apply() const
  struct rsqrt : public migraphx::internal::op::unary<rsqrt>
    #include <migraphx/op/rsqrt.hpp>

    Public Functions

    inline auto apply() const
  struct scalar
    #include <migraphx/op/scalar.hpp>

    Public Functions

    inline std::string name() const
    inline shape compute_shape(std::vector<shape> inputs) const
    inline argument compute(shape output_shape, std::vector<argument> args) const
    inline lifetime get_lifetime() const
    inline std::ptrdiff_t output_alias(const std::vector<shape>&) const

    Public Members

    std::vector<std::size_t> scalar_bcast_lens

    Public Static Functions

    template<class Self, class F>
    static inline auto reflect(Self &self, F f)
  struct scatter
    #include <migraphx/op/scatter.hpp>

    Public Functions

    inline value attributes() const
    inline std::string name() const
    inline shape normalize_compute_shape(std::vector<shape> inputs) const
    inline argument compute(const shape &output_shape, std::vector<argument> args) const

    Public Members

    int64_t axis = 0

    Public Static Functions

    template<class Self, class F>
    static inline auto reflect(Self &self, F f)
  struct sigmoid : public migraphx::internal::op::unary<sigmoid>
    #include <migraphx/op/sigmoid.hpp>

    Public Functions

    inline std::string point_op() const
    inline auto apply() const
  struct sign : public migraphx::internal::op::unary<sign>
    #include <migraphx/op/sign.hpp>

    Public Functions

    inline std::string point_op() const
    inline auto apply() const
  struct sin : public migraphx::internal::op::unary<sin>
    #include <migraphx/op/sin.hpp>

    Public Functions

    inline auto apply() const
  struct sinh : public migraphx::internal::op::unary<sinh>
    #include <migraphx/op/sinh.hpp>

    Public Functions

    inline auto apply() const
  struct slice
    #include <migraphx/op/slice.hpp>

    Public Functions

    inline value attributes() const
    inline std::string name() const
    inline auto fix_index(const std::vector<std::size_t> &lens, std::size_t axis, int64_t index) const
    inline auto compute_offset(const shape &s) const
    inline shape normalize_compute_shape(std::vector<shape> inputs) const
    inline argument compute(shape output_shape, std::vector<argument> args) const
    inline std::ptrdiff_t output_alias(const std::vector<shape>&) const

    Public Members

    std::vector<int64_t> axes
    std::vector<int64_t> starts
    std::vector<int64_t> ends

    Public Static Functions

    template<class Self, class F>
    static inline auto reflect(Self &self, F f)
  struct softmax
    #include <migraphx/op/softmax.hpp>

    Public Functions

    inline value attributes() const
    inline std::string name() const
    inline shape normalize_compute_shape(std::vector<shape> inputs) const
    inline auto output() const

    Public Members

    int64_t axis = 1

    Public Static Functions

    template<class Self, class F>
    static inline auto reflect(Self &self, F f)
  struct sqdiff : public migraphx::internal::op::binary<sqdiff>
    #include <migraphx/op/sqdiff.hpp>

    Public Functions

    inline std::string point_op() const
    inline auto apply() const
  struct sqrt : public migraphx::internal::op::unary<sqrt>
    #include <migraphx/op/sqrt.hpp>

    Public Functions

    inline auto apply() const
  struct squeeze
    #include <migraphx/op/squeeze.hpp>

    Public Functions

    inline value attributes() const
    inline std::string name() const
    inline shape normalize_compute_shape(std::vector<shape> inputs) const
    inline argument compute(shape output_shape, std::vector<argument> args) const
    inline lifetime get_lifetime() const
    inline std::ptrdiff_t output_alias(const std::vector<shape>&) const

    Public Members

    std::vector<int64_t> axes

    Public Static Functions

    template<class Self, class F>
    static inline auto reflect(Self &self, F f)
  struct step
    #include <migraphx/op/step.hpp>

    Public Functions

    inline value attributes() const
    inline std::string name() const
    inline shape normalize_compute_shape(std::vector<shape> inputs) const
    inline argument compute(shape output_shape, std::vector<argument> args) const
    inline lifetime get_lifetime() const
    inline std::ptrdiff_t output_alias(const std::vector<shape>&) const

    Public Members

    std::vector<int64_t> axes
    std::vector<int64_t> steps

    Public Static Functions

    template<class Self, class F>
    static inline auto reflect(Self &self, F f)
  struct sub : public migraphx::internal::op::binary<sub>
    #include <migraphx/op/sub.hpp>

    Public Functions

    inline std::string point_function() const
    inline auto apply() const
  struct tan : public migraphx::internal::op::unary<tan>
    #include <migraphx/op/tan.hpp>

    Public Functions

    inline auto apply() const
  struct tanh : public migraphx::internal::op::unary<tanh>
    #include <migraphx/op/tanh.hpp>

    Public Functions

    inline auto apply() const
  struct topk
    #include <migraphx/op/topk.hpp>

    Public Functions

    inline value attributes() const
    inline std::string name() const
    inline shape normalize_compute_shape(std::vector<shape> inputs) const
    template<class T, class Compare>
    inline heap_vector<T, Compare> make_heap(std::vector<T> val, Compare compare) const
    inline argument compute(const shape &output_shape, std::vector<argument> args) const

    Public Members

    int64_t k = 1
    int64_t axis = 0
    bool largest = true

    Public Static Functions

    template<class Self, class F>
    static inline auto reflect(Self &self, F f)
    template<class T, class Compare>
    struct heap_vector
      #include <migraphx/op/topk.hpp>

      Public Functions

      inline heap_vector(const std::vector<T> &val, Compare comp)
      inline void try_push(T val)
      inline std::vector<T> sort()

      Public Members

      std::vector<T> data
      Compare compare
  struct transpose
    #include <migraphx/op/transpose.hpp>

    Public Functions

    inline std::string name() const
    inline shape compute_shape(std::vector<shape> inputs) const
    inline argument compute(shape output_shape, std::vector<argument> args) const
    inline lifetime get_lifetime() const
    inline std::ptrdiff_t output_alias(const std::vector<shape>&) const

    Public Members

    std::vector<int64_t> dims

    Public Static Functions

    template<class Self, class F>
    static inline auto reflect(Self &self, F f)
  template<class Derived>
  struct unary : public migraphx::internal::op::op_name<Derived>
    #include <migraphx/op/unary.hpp>

    Public Functions

    inline std::string point_function() const
    inline std::string point_op() const
    inline value base_attributes() const
    inline value attributes() const
    inline shape compute_shape(std::vector<shape> inputs) const
    inline argument compute(const shape &output_shape, std::vector<argument> args) const
  struct unary_not : public migraphx::internal::op::unary<unary_not>
    #include <migraphx/op/unary_not.hpp>

    Public Functions

    inline std::string point_function() const
    inline auto apply() const
    inline std::string name() const
  struct undefined
    #include <migraphx/op/undefined.hpp>

    Public Functions

    inline std::string name() const
    inline shape compute_shape(const std::vector<shape> &inputs) const
    inline argument compute(const shape&, const std::vector<argument>&) const
  struct unknown
    #include <migraphx/op/unknown.hpp>

    Public Functions

    inline std::string name() const
    inline shape compute_shape(std::vector<shape> input) const

    Public Members

    std::string op

    Public Static Functions

    template<class Self, class F>
    static inline auto reflect(Self &self, F f)

    Friends

    inline friend friend std::ostream & operator<< (std::ostream &os, const unknown &x)
  struct unsqueeze
    #include <migraphx/op/unsqueeze.hpp>

    Public Functions

    inline value attributes() const
    inline std::string name() const
    inline shape normalize_compute_shape(std::vector<shape> inputs) const
    inline argument compute(shape output_shape, std::vector<argument> args) const
    inline lifetime get_lifetime() const
    inline std::ptrdiff_t output_alias(const std::vector<shape>&) const

    Public Members

    std::vector<int64_t> axes

    Public Static Functions

    template<class Self, class F>
    static inline auto reflect(Self &self, F f)
  struct where
    #include <migraphx/op/where.hpp>

    Public Functions

    inline std::string name() const
    inline value attributes() const
    inline shape compute_shape(std::vector<shape> inputs) const
    inline argument compute(const shape &output_shape, std::vector<argument> args) const
  struct zero
    #include <migraphx/op/reduce_op.hpp>

    Public Functions

    template<class T>
    inline operator T() const