Class: Kumi::IR::Vec::Ops::Node

Inherits:
Base::Instruction show all
Defined in:
lib/kumi/ir/vec/ops/node.rb

Class Attribute Summary collapse

Attributes inherited from Base::Instruction

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

Class Method Summary collapse

Instance Method Summary collapse

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(result:, axes:, dtype:, inputs: [], attributes: {}, metadata: {}, effects: Base::Effects::NONE) ⇒ Node

Returns a new instance of Node.

Raises:

  • (ArgumentError)


17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/kumi/ir/vec/ops/node.rb', line 17

def initialize(result:, axes:, dtype:, inputs: [], attributes: {}, metadata: {}, effects: Base::Effects::NONE)
  raise ArgumentError, "dtype required" unless dtype

  axes = Array(axes || []).map(&:to_sym).freeze
   = .merge(dtype:, axes:)
  super(
    opcode: self.class.opcode_symbol || infer_opcode,
    result:,
    inputs:,
    attributes: attributes,
    metadata: ,
    effects:
  )
end

Class Attribute Details

.opcode_symbolObject (readonly)

Returns the value of attribute opcode_symbol.



9
10
11
# File 'lib/kumi/ir/vec/ops/node.rb', line 9

def opcode_symbol
  @opcode_symbol
end

Class Method Details

.opcode(value = nil) ⇒ Object



11
12
13
14
# File 'lib/kumi/ir/vec/ops/node.rb', line 11

def opcode(value = nil)
  @opcode_symbol = value if value
  @opcode_symbol
end

Instance Method Details

#axesObject



32
# File 'lib/kumi/ir/vec/ops/node.rb', line 32

def axes = [:axes]

#dtypeObject



33
# File 'lib/kumi/ir/vec/ops/node.rb', line 33

def dtype = [:dtype]