Class: Kumi::IR::Loop::Ops::Node
- Inherits:
-
Base::Instruction
- Object
- Base::Instruction
- Kumi::IR::Loop::Ops::Node
- Defined in:
- lib/kumi/ir/loop/ops/node.rb
Direct Known Subclasses
AccInit, AccLoad, AccStep, ArrayInit, ArrayLen, ArrayPush, Constant, IndexRead, KernelCall, LoadField, LoadInput, LoopEnd, LoopStart, MakeObject, Ref, Select, ShiftInBounds, ShiftRead
Class Attribute Summary collapse
-
.opcode_symbol ⇒ Object
readonly
Returns the value of attribute opcode_symbol.
Attributes inherited from Base::Instruction
#attributes, #axes, #dtype, #effects, #inputs, #metadata, #opcode, #result
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(result: nil, axes: [], dtype: nil, inputs: [], attributes: {}, metadata: {}, effects: Base::Effects::NONE) ⇒ Node
constructor
A new instance of Node.
- #to_h ⇒ Object
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_print_string, #uses, #validate!, #value_signature, #with_metadata
Constructor Details
#initialize(result: nil, axes: [], dtype: nil, inputs: [], attributes: {}, metadata: {}, effects: Base::Effects::NONE) ⇒ Node
Returns a new instance of Node.
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/kumi/ir/loop/ops/node.rb', line 17 def initialize(result: nil, axes: [], dtype: nil, inputs: [], attributes: {}, metadata: {}, effects: Base::Effects::NONE) axes = Array(axes || []).map(&:to_sym).freeze = .merge(axes: axes) = .merge(dtype: dtype) if dtype super( opcode: self.class.opcode_symbol || infer_opcode, result: result, inputs: inputs, attributes: attributes, metadata: , effects: effects ) end |
Class Attribute Details
.opcode_symbol ⇒ Object (readonly)
Returns the value of attribute opcode_symbol.
9 10 11 |
# File 'lib/kumi/ir/loop/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/loop/ops/node.rb', line 11 def opcode(value = nil) @opcode_symbol = value if value @opcode_symbol end |
Instance Method Details
#to_h ⇒ Object
31 32 33 |
# File 'lib/kumi/ir/loop/ops/node.rb', line 31 def to_h super.merge(axes: axes, dtype: dtype) end |