Class: Kumi::IR::Vec::Ops::AxisShift

Inherits:
Node show all
Defined in:
lib/kumi/ir/vec/ops/core_ops.rb

Constant Summary collapse

POLICIES =
%i[wrap clamp zero].freeze

Instance Attribute Summary

Attributes inherited from Base::Instruction

#attributes, #axes, #dtype, #effects, #inputs, #metadata, #opcode, #result

Instance Method Summary collapse

Methods inherited from Node

#axes, #dtype, opcode

Methods inherited from Base::Instruction

#control_effect?, #defs, #effectful?, #io_effect?, #memory_effect?, #normalized_attributes, #printer_attributes, #printer_axes, #printer_dtype, #produces?, #stamp, #state_effect?, #to_h, #to_print_string, #uses, #validate!, #value_signature, #with_metadata

Constructor Details

#initialize(source:, axis:, offset:, policy:, **kwargs) ⇒ AxisShift

Returns a new instance of AxisShift.

Raises:

  • (ArgumentError)


67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/kumi/ir/vec/ops/core_ops.rb', line 67

def initialize(source:, axis:, offset:, policy:, **kwargs)
  policy = policy.to_sym
  raise ArgumentError, "invalid policy #{policy}" unless POLICIES.include?(policy)

  attrs = {
    axis: axis.to_sym,
    offset: Integer(offset),
    policy: policy
  }
  axes = kwargs[:axes] || extract_axes(source)
  super(inputs: [source], attributes: attrs, axes:, **kwargs)
end