Class: Kumi::IR::DF::Ops::AxisOuter

Inherits:
Node show all
Defined in:
lib/kumi/ir/df/ops/axis_outer.rb

Overview

Re-exposes ‘source` (an array over `source_axis`, belonging to a DIFFERENT carrier array than the surrounding expression) as a fresh inner axis. The result has the surrounding axes plus `axis` appended as the new innermost axis, so element (i, j) reads source. Where AxisCross self-joins one array (A x A’), AxisOuter pairs two distinct arrays (A x B): the broadcast that makes pixels-x-lights style rasterization (and any two-array all-pairs) expressible.

Instance Attribute Summary

Attributes inherited from Base::Instruction

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

Instance Method Summary collapse

Methods inherited from Node

opcode, #to_h

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) ⇒ AxisOuter

Returns a new instance of AxisOuter.



17
18
19
20
21
22
23
24
25
26
# File 'lib/kumi/ir/df/ops/axis_outer.rb', line 17

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

#axisObject



29
# File 'lib/kumi/ir/df/ops/axis_outer.rb', line 29

def axis = attributes[:axis]

#sourceObject



28
# File 'lib/kumi/ir/df/ops/axis_outer.rb', line 28

def source = inputs.first

#source_axisObject



30
# File 'lib/kumi/ir/df/ops/axis_outer.rb', line 30

def source_axis = attributes[:source_axis]