Class: Kumi::IR::DF::Ops::AxisCross
- Inherits:
-
Node
- Object
- Base::Instruction
- Node
- Kumi::IR::DF::Ops::AxisCross
- Defined in:
- lib/kumi/ir/df/ops/axis_cross.rb
Overview
Re-exposes source (an array over source_axis) under a fresh,
independent axis axis backed by the same carrier. The result has the
source's axes plus axis appended as the new innermost axis, so the
element at (i, j) reads source. This is the broadcast-dual of a
reduction and is what makes all-pairs / self-join computations
(e.g. N-body) expressible.
Instance Attribute Summary
Attributes inherited from Base::Instruction
#attributes, #axes, #dtype, #effects, #inputs, #metadata, #opcode, #result
Instance Method Summary collapse
- #axis ⇒ Object
-
#initialize(source:, axis:, source_axis:, **kwargs) ⇒ AxisCross
constructor
A new instance of AxisCross.
- #source ⇒ Object
- #source_axis ⇒ 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(source:, axis:, source_axis:, **kwargs) ⇒ AxisCross
Returns a new instance of AxisCross.
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/kumi/ir/df/ops/axis_cross.rb', line 16 def initialize(source:, axis:, source_axis:, **kwargs) super( inputs: [source], attributes: { axis: axis.to_sym, source_axis: source_axis.to_sym }, **kwargs ) end |
Instance Method Details
#axis ⇒ Object
28 |
# File 'lib/kumi/ir/df/ops/axis_cross.rb', line 28 def axis = attributes[:axis] |
#source ⇒ Object
27 |
# File 'lib/kumi/ir/df/ops/axis_cross.rb', line 27 def source = inputs.first |
#source_axis ⇒ Object
29 |
# File 'lib/kumi/ir/df/ops/axis_cross.rb', line 29 def source_axis = attributes[:source_axis] |