Operators

Contents

Operators#

Applies to Linux

2024-05-07

112 min read time

operation#

struct 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 – Equivalent to running compute_shape with each shape of the argument. For a fixed shape, the returned argument will have the same shape as output. For a dynamic shape, the returned argument will be a fixed shape within the bounds set in the dynamic shape output.

  • 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 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 op#

Enums

enum padding_mode_t#

Values:

enumerator default_#
enumerator same_lower#
enumerator same_upper#
enum class pooling_mode#

Values:

enumerator average#
enumerator max#
enumerator lpnorm#
enum class rnn_direction#

Values:

enumerator forward#
enumerator reverse#
enumerator bidirectional#
enum class normalize_attribute#

normalize_attribute settings: Note that default options are not included as enums.

  1. use_input (default) vs. use_output: Affects the rank of the attribute. use_input -> lens.size(), use_output -> lens.size() + vec.size().

  2. use_rank (default) vs use_len: use_rank sets the max value/index of the attribute as the rank of lens. use_lens sets the max value/index as the corresponding value in lens at the axes index. Uses the dynamic_dimension.max value for dynamic shapes. Returns the original vector (no normalization) if any of dynamic_dimension[axes] are not fixed.

  3. clip_min vs. not_clip_min (default): Clip values less than the minimum to the minimum or not.

  4. include_min vs. exclude_min (default): Include or exclude the minimum value/index for range checking and clipping.

  5. clip_max vs. not_clip_max (default): Clip values greater than the maximum or not.

  6. include_max vs. exclude_max (default): Include or exclude the maximum value/index for range checking and clipping.

  7. normalize_padding: To normalize the padding to 2*(pad ndim) dimensions.

Values:

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

Functions

std::ostream &operator<<(std::ostream &os, pooling_mode v)#
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 allocate#
#include <migraphx/op/allocate.hpp>

Static allocate: No inputs: allocate() this.s attribute set to the static output shape of the buffer. this.s attribute can be set to a dynamic output shape; however this will allocate the maximum buffer size for that case

Dynamic allocate: One input: allocate(output_dims) output_dims are the output buffer dimensions and has a static shape. Either this.s or this.buf_type (but not both) must be set to calculate the dynamic output shape at compute time. If this.buf_type is set, the compute_shape() of allocate at compile time will have dynamic_dimensions from {0, max_int} with rank = output_dims.ndim(). If this.s is set then the compute_shape() will output this.s; this.s should be a dynamic shape.

Public Functions

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

Public Members

optional<shape> s#
optional<shape::type_t> buf_type#

Public Static Functions

template<class Self, class F>
static inline auto reflect(Self &self, F f)#
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 dyn_output &dyn_out, std::vector<argument> args) const#

Public Members

int64_t axis = 0#
bool select_last_index = false#

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#
bool select_last_index = false#

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 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#
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 dyn_output &dyn_out, std::vector<argument> args) const#
struct broadcast#
#include <migraphx/op/broadcast.hpp>

1 input version: Broadcasts a tensor from the original shape to the broadcast_lens by setting the stride of broadcasted dimensions to zero. axis attribute for a 1D input shape is the output dimension that stays the same. ex: broadcasting shape [1024] -> [4, 1024, 3] has axis = 1.

For higher rank input shapes, axis is an offset parameter for the broadcasting. Such that this operator would work in the opposite direction of NumPy broadcasting (left-most to rightwards element-wise comparison) ex: broadcasting shape [2, 2] -> [2, 2, 3] with axis = 0

2 input version: Broadcast the first input 1D shape into the second input shape based on the axis parameter. Handles broadcasting a 1D static shape into a higher rank dynamic shape. broadcast_lens is not used

Public Functions

inline std::string name() const#
inline shape compute_shape(std::vector<shape> inputs) const#
inline argument compute(const dyn_output &dyn_out, std::vector<argument> args) 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 broadcast_for_dot#
#include <migraphx/op/broadcast_for_dot.hpp>

Broadcast dimensions between two tensors for the dot operator. Essentially broadcasts between two shapes for dimensions other than the last two. This operator is only needed if one of the shapes are dynamic. Example: a = shape[{1, 4}, 3, 248, 248] b = shape[248, 365] broadcast_for_dot(a, b) => shape[{1, 4}, 3, 248, 248] (no change) broadcast_for_dot(b, a) => shape[{1, 4}, 3, 248, 365]

Public Functions

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

Broadcast the input tensor to the shape defined by the values of the second input. Used as broadcast_with_dims(input_tensor, dims), where dims is a vector of integer dimensions. input_tensor must be broadcastable with dims, otherwise this operator with throw at compute. This operator can be replaced with multibroadcast(input_tensor) if the dims vector is constant.

Example: input_tensor shape: lens = {2, 3}, strides = {3, 1} dims = [4, 1, 3] output shape: lens = {4, 2, 3}, strides = {0, 3, 1}

Public Functions

inline std::string name() const#
inline shape compute_shape(const std::vector<shape> &inputs) const#
inline argument compute(const shape &output_shape, const std::vector<argument> &args) const#
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 dyn_output &dyn_out, 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 dyn_output &dyn_out, 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 dyn_output &dyn_out, 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>

Convolution operator. Does not support optimal dimensions for spatial dimensions. Returns empty optimals.

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 std::vector<std::size_t> calc_conv_lens(std::vector<std::size_t> x_lens, std::vector<std::size_t> w_lens) const#
inline shape dynamic_compute_shape(shape x_shape, shape w_shape) const#
inline shape static_compute_shape(shape x_shape, shape w_shape) const#
inline size_t kdims() const#
inline argument compute(shape output_shape, std::vector<argument> args) 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 convolution_backwards#
#include <migraphx/op/convolution_backwards.hpp>

Public Functions

inline std::string name() const#
inline void check_attribute_size() const#
inline shape compute_shape(std::vector<shape> inputs) const#
inline std::vector<std::size_t> calc_spatial_lens(std::vector<std::size_t> x_lens, std::vector<std::size_t> w_lens) const#
inline shape dynamic_compute_shape(shape x_shape, shape w_shape) const#
inline shape static_compute_shape(shape x_shape, shape w_shape) const#
inline argument compute(const dyn_output &dyn_out, 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 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 dequantizelinear#
#include <migraphx/op/dequantizelinear.hpp>

Public Functions

inline value attributes() const#
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 dimensions_of#
#include <migraphx/op/dimensions_of.hpp>

Returns the dimensions of the input argument from starting axis to ending axis. Atleast end must be set to use this operator (set end to ndim for default ONNX behavior of Shape operator) This should only be used for dynamic shapes as this can be simplified to a literal for static shapes.

Public Functions

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

Public Members

std::size_t start = 0#
std::size_t end = 0#

Public Static Functions

template<class Self, class F>
static inline auto reflect(Self &self, F f)#
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>

Matrix multiplication of two tensors.

Public Functions

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

Public Functions

inline std::string point_op() const#
inline auto apply() 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 fill#
#include <migraphx/op/fill.hpp>

fill(default_value, output_buffer) Fill an output buffer with the given default_value. Note that if the default_value is a literal and the output_buffer has a static shape this operator can be replaced with a literal.

Public Functions

inline std::string name() const#
inline shape compute_shape(std::vector<shape> inputs) const#
inline argument compute(const dyn_output &dyn_out, std::vector<argument> args) const#
inline std::ptrdiff_t output_alias(const std::vector<shape>&) 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(const dyn_output &dyn_out, std::vector<argument> args) 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 fmod : public migraphx::internal::op::binary<fmod>#
#include <migraphx/op/fmod.hpp>

Public Functions

inline std::string name() const#
inline value attributes() const#
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 dyn_output &dyn_out, 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 gathernd#
#include <migraphx/op/gathernd.hpp>

Public Functions

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

Public Members

int batch_dims = 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 value attributes() 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 isinf : public migraphx::internal::op::unary<isinf>#
#include <migraphx/op/isinf.hpp>

Public Functions

inline auto apply() const#
inline std::string name() const#
inline shape compute_shape(std::vector<shape> inputs) const#
struct isnan : public migraphx::internal::op::unary<isnan>#
#include <migraphx/op/isnan.hpp>

Public Functions

inline auto apply() const#
inline std::string name() const#
inline shape compute_shape(std::vector<shape> inputs) const#
struct layout : public migraphx::internal::op::unary<layout>#
#include <migraphx/op/layout.hpp>

Public Functions

inline shape compute_shape(std::vector<shape> inputs) const#
inline auto apply() const#

Public Members

std::vector<int64_t> permutation#

Public Static Functions

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

Public Functions

inline std::string point_op() const#
inline std::string name() const#
inline auto apply() 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 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 mod : public migraphx::internal::op::binary<mod>#
#include <migraphx/op/mod.hpp>

Public Functions

inline std::string name() const#
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>

Broadcast multiple dimensions between two tensors. Two versions of this operator: 1 input and 2+ inputs. One input version uses output_lens attribute and broadcasts to it. 2+ inputs version broadcasts first input to the common shape at evaluation time.

Public Functions

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

Public Members

std::vector<std::size_t> output_lens = {}#
std::vector<shape::dynamic_dimension> output_dyn_dims = {}#

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 dyn_output &dyn_out, 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 nearbyint : public migraphx::internal::op::unary<nearbyint>#
#include <migraphx/op/nearbyint.hpp>

Public Functions

inline auto apply() const#
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(T boxes, std::size_t box_idx) const#
inline bool suppress_by_iou(box b1, box b2, double iou_threshold) const#
template<class T>
inline std::vector<std::pair<double, int64_t>> filter_boxes_by_score(T scores_start, std::size_t num_boxes, double score_threshold) const#
template<class Output, class Boxes, class Scores>
inline std::size_t compute_nms(Output output, Boxes boxes, Scores scores, std::size_t max_output_boxes_per_class, double iou_threshold, double score_threshold) const#
inline argument compute(const shape &output_shape, std::vector<argument> args) const#

Public Members

bool center_point_box = false#
bool use_dyn_output = 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<double, 2> &operator[](std::size_t i)#
inline double area() const#

Public Members

std::array<double, 2> x#
std::array<double, 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< add >, migraphx::internal::op::binary< div >, migraphx::internal::op::binary< equal >, migraphx::internal::op::binary< fmod >, migraphx::internal::op::binary< greater >, migraphx::internal::op::binary< less >, migraphx::internal::op::binary< logical_and >, migraphx::internal::op::binary< logical_or >, migraphx::internal::op::binary< logical_xor >, migraphx::internal::op::binary< max >, migraphx::internal::op::binary< min >, migraphx::internal::op::binary< mod >, migraphx::internal::op::binary< mul >, migraphx::internal::op::binary< pow >, migraphx::internal::op::binary< prelu >, migraphx::internal::op::binary< sqdiff >, migraphx::internal::op::binary< sub >, migraphx::internal::op::prefix_scan_op< prefix_scan_sum >, migraphx::internal::op::reduce_op< reduce_max >, migraphx::internal::op::reduce_op< reduce_mean >, migraphx::internal::op::reduce_op< reduce_min >, migraphx::internal::op::reduce_op< reduce_prod >, migraphx::internal::op::reduce_op< reduce_sum >, migraphx::internal::op::scatter_op< scatter_add >, migraphx::internal::op::scatter_op< scatter_max >, migraphx::internal::op::scatter_op< scatter_min >, migraphx::internal::op::scatter_op< scatter_mul >, migraphx::internal::op::scatter_op< scatter_none >, migraphx::internal::op::scatternd_op< scatternd_add >, migraphx::internal::op::scatternd_op< scatternd_max >, migraphx::internal::op::scatternd_op< scatternd_min >, migraphx::internal::op::scatternd_op< scatternd_mul >, migraphx::internal::op::scatternd_op< scatternd_none >, migraphx::internal::op::unary< abs >, migraphx::internal::op::unary< acos >, migraphx::internal::op::unary< acosh >, migraphx::internal::op::unary< asin >, migraphx::internal::op::unary< asinh >, migraphx::internal::op::unary< atan >, migraphx::internal::op::unary< atanh >, migraphx::internal::op::unary< ceil >, migraphx::internal::op::unary< convert >, migraphx::internal::op::unary< cos >, migraphx::internal::op::unary< cosh >, migraphx::internal::op::unary< elu >, migraphx::internal::op::unary< erf >, migraphx::internal::op::unary< exp >, migraphx::internal::op::unary< floor >, migraphx::internal::op::unary< isinf >, migraphx::internal::op::unary< isnan >, migraphx::internal::op::unary< layout >, migraphx::internal::op::unary< leaky_relu >, migraphx::internal::op::unary< log >, migraphx::internal::op::unary< nearbyint >, migraphx::internal::op::unary< neg >, migraphx::internal::op::unary< recip >, migraphx::internal::op::unary< relu >, migraphx::internal::op::unary< rsqrt >, migraphx::internal::op::unary< sigmoid >, migraphx::internal::op::unary< sign >, migraphx::internal::op::unary< sin >, migraphx::internal::op::unary< sinh >, migraphx::internal::op::unary< sqrt >, migraphx::internal::op::unary< tan >, migraphx::internal::op::unary< tanh >, migraphx::internal::op::unary< unary_not >, migraphx::internal::op::binary< Derived >, migraphx::internal::op::prefix_scan_op< Derived >, migraphx::internal::op::reduce_op< Derived >, migraphx::internal::op::scatter_op< Derived >, migraphx::internal::op::scatternd_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 pack_int4#
#include <migraphx/op/pack_int4.hpp>

Public Functions

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

Public Members

int64_t axis = -1#

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 size_t kdims() const#
inline value attributes() const#
inline std::size_t dilate_dim(std::size_t dim, std::size_t dilation) const#
inline std::vector<std::size_t> calc_spatial_dim_out(const std::vector<std::size_t> &input_lens, std::size_t kdims) const#
inline shape normalize_compute_shape(std::vector<shape> inputs) const#
template<class Type, class Out, class In, class Op>
inline void calc_pooling(const shape &output_shape, Out &output, const In &input, const std::vector<std::size_t> &kernel_dims, const std::vector<std::size_t> &padding_vals, Op op) const#
inline argument compute(const dyn_output &dyn_out, std::vector<argument> args) const#

Public Members

pooling_mode mode = {pooling_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}#
std::vector<std::size_t> dilations = {1, 1}#
bool ceil_mode = false#
int lp_order = 2#
padding_mode_t padding_mode = padding_mode_t::default_#
bool dyn_global = false#
bool count_include_pad = false#

Public Static Functions

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

Public Functions

template<class T>
inline double init() const#
inline double operator()(double x, double y) const#
inline double final(double x, std::size_t y) const#
struct lpnorm_pool#
#include <migraphx/op/pooling.hpp>

Public Functions

lpnorm_pool() = delete#
inline explicit lpnorm_pool(int x)#
template<class T>
inline double init() const#
inline double operator()(double x, double y) const#
inline double final(double x, std::size_t) const#

Public Members

int p = 0#
struct max_pool#
#include <migraphx/op/pooling.hpp>

Public Functions

template<class T>
inline T init() const#
inline double operator()(double x, double y) const#
inline double final(double x, std::size_t) const#
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>

Parent struct for prefix scan operations. A prefix scan is equivalent to the C++ std::exclusive_scan or std::inclusive_scan. Given a list of numbers, a prefix scan sum op returns an equal size list of running totals of the values. Other operations besides addition can be supported by their own child ops.

Public Functions

inline value attributes() const#
inline shape normalize_compute_shape(std::vector<shape> inputs) const#
inline argument compute(const dyn_output &dyn_out, 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#
inline argument compute(shape output_shape, std::vector<argument> args) 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 value attributes() 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::optional<migraphx::shape::type_t> out_type#

Public Static Functions

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

Generates a random seed for the use of random number generators. Generating the seed at runtime guarantees there will be a different random sequence on every execution. This operation has no inputs or attributes, and outputs an unsigned integer tensor with a single value.

Public Functions

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

Public Members

shape::type_t dtype = shape::type_t::uint64_type#

Public Static Functions

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

random_uniform populates the passed shape with random numbers, in a uniform distribution. Range for floating-point data types is (0, 1); for integer types it is [0, <max value for the type>]

Public Functions

inline std::string name() const#
inline shape compute_shape(std::vector<shape> inputs) const#
inline argument compute(const dyn_output &dyn_out, std::vector<argument> args) const#
inline std::ptrdiff_t output_alias(const std::vector<shape>&) 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 shape collapse_reduced_axes(const shape &original_shape, const std::vector<int64_t> &reduce_axes) const#
inline shape compute_dynamic_shape(const std::vector<shape> &inputs) const#
inline shape compute_static_shape(const std::vector<shape> &inputs) const#
inline shape normalize_compute_shape(std::vector<shape> inputs) const#

returns a shape in which the axis or axes named for reduction by this op are set, to size 1.

Parameters:

inputs – list of input shapes

Returns:

shape

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(const tensor_view<T> &input, const shape &batch_shape, const std::vector<int64_t> &tuned_axes, const std::vector<std::size_t> &out_idx, tensor_view<T> &output) const#
inline argument reduce(const shape &computed_shape, const std::vector<int64_t> &reduce_axes, argument &data_arg) const#
inline argument compute(const dyn_output &dyn_out, 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>

1 input version: reshape(input_data) this.dims = output_dims Makes a copy of input_data to the output shape.

2 input version: reshape(input_data, output_buffer) this.dims = unset Copies input_data to output_buffer; output_buffer already has the output shape. This version will not fail gracefully if the input shape and output_buffer shape are incompatible. There’s a throw that will catch when the number of elements do not match at runtime. This version should only be used for dynamic reshapes (output dimensions only known at runtime). If output_buffer has a static shape during compile/parse, you can use the 1 input version.

Public Functions

inline std::string name() const#
inline shape dyn_compute_shape(shape s0) const#
inline shape static_compute_shape(std::vector<shape> inputs, std::size_t n_neg_dims) const#
inline shape compute_shape(std::vector<shape> inputs) const#
inline argument compute(const dyn_output &dyn_out, std::vector<argument> args) 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 reshape_lazy#
#include <migraphx/op/reshape_lazy.hpp>

Public Functions

inline value attributes() const#
inline std::string name() const#
inline shape dyn_compute_shape(shape s0) const#
inline shape static_compute_shape(std::vector<shape> inputs, std::size_t n_neg_dims) const#
inline shape compute_shape(std::vector<shape> inputs) const#
inline argument compute(const dyn_output &dyn_out, std::vector<argument> args) 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 Iterator>
static inline auto compute_end_dim(Iterator start, Iterator last, std::size_t dim)#
template<class OptionalPair>
static inline OptionalPair try_merge_pairs(OptionalPair p2, OptionalPair p1)#
template<class DimIterator, class StrideIterator>
static inline optional<std::size_t> merge_strides(DimIterator dim_start, DimIterator dim_last, StrideIterator stride_start, StrideIterator stride_last)#
template<class DimIterator, class StrideIterator>
static inline auto can_strides_merge(DimIterator dim_start, DimIterator dim_last, StrideIterator stride_start, StrideIterator stride_last)#
static inline optional<shape> reshape_lazy_dims(const shape &input, const std::vector<std::size_t> &rdims)#
struct resize#
#include <migraphx/op/resize.hpp>

The Resize operation mirrors the Onnx Resize operation with some differences. Currently, only Nearest mode is supported. “Axes” and “ROI” attributes not recognized.

Accepts either one or two runtime inputs. Input 0 - data to be resized Input 1 - sizes or scales. If data type is uint64, Input 1 is interpreted as output sizes; otherwise as scaling factors.

If the second input is not used, either a “sizes” or “scales” attribute must be provided.

Public Functions

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

Public Members

std::vector<float> scales#
std::vector<size_t> sizes#
std::string nearest_mode = {"floor"}#
std::string mode = {"nearest"}#
std::string coordinate_transformation_mode#

Public Static Functions

static inline auto &get_nearest_op(const std::string &near_mode)#
static inline auto &get_original_idx_op(const std::string &s_mode)#
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"#
pooling_mode mode = {pooling_mode::average}#
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 rsqrt : public migraphx::internal::op::unary<rsqrt>#
#include <migraphx/op/rsqrt.hpp>

Public Functions

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

Public Functions

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

Public Members

std::size_t target_id = 0#

Public Static Functions

template<class Self, class F>
static inline auto reflect(Self &self, F f)#
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 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_add : public migraphx::internal::op::scatter_op<scatter_add>#
#include <migraphx/op/scatter_add.hpp>

Public Functions

inline auto reduction() const#
struct scatter_max : public migraphx::internal::op::scatter_op<scatter_max>#
#include <migraphx/op/scatter_max.hpp>

Public Functions

inline auto reduction() const#
struct scatter_min : public migraphx::internal::op::scatter_op<scatter_min>#
#include <migraphx/op/scatter_min.hpp>

Public Functions

inline auto reduction() const#
struct scatter_mul : public migraphx::internal::op::scatter_op<scatter_mul>#
#include <migraphx/op/scatter_mul.hpp>

Public Functions

inline auto reduction() const#
struct scatter_none : public migraphx::internal::op::scatter_op<scatter_none>#
#include <migraphx/op/scatter_none.hpp>

Public Functions

inline auto reduction() const#
template<typename Derived>
struct scatter_op : public migraphx::internal::op::op_name<Derived>#
#include <migraphx/op/scatter_op.hpp>

Public Functions

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

Public Members

int64_t axis = 0#

Public Static Functions

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

Public Functions

inline scatternd_add()#
inline auto reduction() const#
struct scatternd_max : public migraphx::internal::op::scatternd_op<scatternd_max>#
#include <migraphx/op/scatternd_max.hpp>

Public Functions

inline scatternd_max()#
inline auto reduction() const#
struct scatternd_min : public migraphx::internal::op::scatternd_op<scatternd_min>#
#include <migraphx/op/scatternd_min.hpp>

Public Functions

inline scatternd_min()#
inline auto reduction() const#
struct scatternd_mul : public migraphx::internal::op::scatternd_op<scatternd_mul>#
#include <migraphx/op/scatternd_mul.hpp>

Public Functions

inline scatternd_mul()#
inline auto reduction() const#
struct scatternd_none : public migraphx::internal::op::scatternd_op<scatternd_none>#
#include <migraphx/op/scatternd_none.hpp>

Public Functions

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

N-dimensional Scatter operations. This struct is parent class to ops which differ in what formula is used to reduce (combine old and new values of) the scattered value. It was originally based on Onnx ScatterND operation (see onnx/onnx) and is also similar to Numpy numpy.add.at().

Template Parameters:

Derived – a template parameter in the CRTP inheritance idiom, represents one of the child operations.

Public Functions

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

Validate input shapes and return the correct output shape. For Scatter ops, the output is the same shape as the data tensor (first input), but cast to a standard shape.

inline argument compute(const dyn_output &dyn_out, std::vector<argument> args) const#
inline auto init() const#
inline scatternd_op()#
struct select_module#
#include <migraphx/op/select_module.hpp>

Public Functions

inline std::string name() const#
inline shape compute_shape(const std::vector<shape> &inputs, const std::vector<module_ref>&) const#
inline std::vector<std::string> get_input_parameter_names(module_ref mod) const#
inline std::vector<std::string> get_output_parameter_names(module_ref mod) const#
inline argument compute(const shape&, const std::vector<argument> &args, const std::vector<module_ref> &submodule_list, const std::function<std::vector<argument>(module_ref&, const std::unordered_map<std::string, argument>&)> &run) const#
inline std::ptrdiff_t output_alias(const std::vector<shape> &shapes) const#

Public Members

shape output_dyn_shapes#

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>

Slice operator that accepts variable axes, starts and ends. All of starts, ends, and axes must be supplied by either their attribute or an input (but not both).

Valid calls: slice(input); axes, starts, ends set slice(input, starts); axes, ends set slice(input, ends); starts, axes set slice(input, axes); starts, ends set slice(input, starts, ends); axes set slice(input, starts, axes); ends set slice(input, ends, axes); starts set slice(input, start, ends, axes); none set

Attributes: axes: constant axes to slice over (optional) starts: constant slice starting indices (optional) ends: constant slice ending indices (optional)

Parameters: data: the input tensor to slice (dynamic or static shape) input_starts: starting indices of slice (optional, static shape) input_ends: ending indices of slice (optional, static shape) input_axes: axes to slice over (optional, static shape)

Public Functions

inline value attributes() const#

Ensure that attribute axes is within limits. Will attempt to normalize starts and ends; but will use the dynamic_dimension.max values for dynamic shapes. This makes it so you have to renormalize for non-fixed dynamic_dimensions.

inline std::string name() const#
template<class A, class B>
inline std::vector<std::size_t> lens_calc(const std::vector<std::size_t> &lengths, A in_starts, A in_ends, B in_axes) const#

Computes the slice output shape dimensions for given starts, ends,and axes. Templated to also handle tensor views. Possibly different type between [in_starts, in_ends] and [in_axes] if in_axes is this object’s axes attribute. Assumes in_starts and in_ends are normalized; in_axes are valid.

inline std::array<bool, 3> get_set_attributes() const#

Get the attributes that are non-empty.

inline shape compute_two_or_more(std::vector<shape> inputs) const#

Helper function for normalize_compute_shape()

inline shape normalize_compute_shape(std::vector<shape> inputs) const#
inline auto compute_offset(const shape &s) const#

Calculates the starting offset for the sliced tensor. Used in compute when only data input and all other information are in the attributes.

Parameters:

s – static input shape

template<class T>
inline auto compute_offset(const shape &s, const T &input_starts, const T &ax_vec) const#

Calculates the starting offset for the sliced tensor (for aliasing). Used for 2-4 inputs to `slice.

Parameters:
  • s – static input shape

  • input_starts – starting indices of slice

  • ax_vec – axes to slice on

inline std::unordered_map<std::string, std::vector<int64_t>> normalize_starts_ends_axes(shape input_shape, const optional<std::vector<int64_t>> &input_starts, const optional<std::vector<int64_t>> &input_ends, const optional<std::vector<int64_t>> &input_axes) const#

If given, normalize the inputs. Otherwise get from operator attributes. Return the values in a map.

Parameters input_shape: static shape of the input input_starts: optional input_ends: optional input_ends: optional

inline argument compute(const dyn_output &dyn_out, 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)#

Public Static Attributes

static constexpr std::array<bool, 3> all_set = {true, true, true}#

Named arrays for the set attribute possibilities.

static constexpr std::array<bool, 3> ends_axes = {false, true, true}#
static constexpr std::array<bool, 3> starts_axes = {true, false, true}#
static constexpr std::array<bool, 3> starts_ends = {true, true, false}#
static constexpr std::array<bool, 3> axes_only = {false, false, true}#
static constexpr std::array<bool, 3> ends_only = {false, true, false}#
static constexpr std::array<bool, 3> starts_only = {true, false, false}#
static constexpr std::array<bool, 3> none_set = {false, false, false}#
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(const dyn_output &dyn_out, std::vector<argument> args) 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 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(const dyn_output &dyn_out, std::vector<argument> args) 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 dyn_output &dyn_out, 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 unique#
#include <migraphx/op/unique.hpp>

Public Functions

template<class T>
inline auto make_idx_less_fn(const T &data, size_t chunk_sz) const#
template<class T>
inline auto sorted_uniq_indices(const T &input_data, size_t chunk_sz) const#
template<class T>
inline auto unsorted_uniq_indices(const T &input_data, size_t chunk_sz) const#
inline std::string name() const#
inline shape compute_shape(std::vector<shape> inputs) const#
inline argument compute(const dyn_output &dyn_out, std::vector<argument> args) const#

Public Members

std::optional<int64_t> axis#
bool sorted = true#

Public Static Functions

template<class Self, class F>
static inline auto reflect(Self &self, F f)#
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 std::ostream &operator<<(std::ostream &os, const unknown &x)#
struct unpack_int4#
#include <migraphx/op/unpack_int4.hpp>

Public Functions

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

Public Members

int64_t axis = -1#

Public Static Functions

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

Adds dimensions to a tensor based on the axes attribute. axes are based on the number of output shape dimensions and should not contain duplicates. steps are for modifying dimensions added to the middle of the original shape. Each step must be a factor of the original dimension. ex: unsqueeze(shape = [3, 4, 10], axes = [2, 4, 5], steps = [2]) -> shape = [3, 4, 2, 5, 1, 1] Dynamic shape version does not handle steps.

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 dyn_output &dyn_out, 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> steps#

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(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#