Class: Kumi::IR::Vec::Ops::Reduce

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

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(fn:, arg:, over_axes:, **kwargs) ⇒ Reduce

Returns a new instance of Reduce.



98
99
100
101
102
103
104
105
# File 'lib/kumi/ir/vec/ops/core_ops.rb', line 98

def initialize(fn:, arg:, over_axes:, **kwargs)
  attrs = {
    fn: fn.to_sym,
    over_axes: Array(over_axes).map(&:to_sym)
  }
  axes = kwargs[:axes] || derive_axes(arg, attrs[:over_axes])
  super(inputs: [arg], attributes: attrs, axes:, **kwargs)
end