ScalarOperationsConverter
Converter for scalar tensor operations: tensor + scalar, tensor * scalar, etc.
The KSP-generated tracing wrapper records these as ops named addScalar / subScalar / mulScalar / divScalar / rsubScalar / rdivScalar, with one tensor input and the scalar literal stored in operation.parameters["b"] (or "scalar"). The StableHLO lowering materializes the scalar as a splat constant of the output type, then applies the corresponding binary op.
rsubScalar(a, x) = a - x (scalar on the left); rdivScalar(a, x) = a / x.
Functions
Link copied to clipboard
open override fun convert(node: GraphNode, operands: List<String>, context: ConversionContext): ConversionResult
Convert a graph node to StableHLO operations