Class: Kumi::IR::DF::Ops::ArrayGet
- Inherits:
-
Node
- Object
- Base::Instruction
- Node
- Kumi::IR::DF::Ops::ArrayGet
- Defined in:
- lib/kumi/ir/df/ops/array_get.rb
Constant Summary collapse
- OOB_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
- #array ⇒ Object
- #index ⇒ Object
-
#initialize(array:, index:, oob:, **kwargs) ⇒ ArrayGet
constructor
A new instance of ArrayGet.
- #oob_policy ⇒ Object
Methods inherited from Node
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(array:, index:, oob:, **kwargs) ⇒ ArrayGet
Returns a new instance of ArrayGet.
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/kumi/ir/df/ops/array_get.rb', line 11 def initialize(array:, index:, oob:, **kwargs) oob = oob.to_sym raise ArgumentError, "invalid oob policy #{oob}" unless OOB_POLICIES.include?(oob) super( inputs: [array, index], attributes: { oob: oob }, **kwargs ) end |
Instance Method Details
#array ⇒ Object
22 |
# File 'lib/kumi/ir/df/ops/array_get.rb', line 22 def array = inputs[0] |
#index ⇒ Object
23 |
# File 'lib/kumi/ir/df/ops/array_get.rb', line 23 def index = inputs[1] |
#oob_policy ⇒ Object
24 |
# File 'lib/kumi/ir/df/ops/array_get.rb', line 24 def oob_policy = attributes[:oob] |