Skip to content

vector.reduce.axes

vector dialect

Reduce the explicit source axes of a vector while preserving the remaining axes in their original order. The init operand and result have the same type: scalar when every source axis is reduced, or a vector whose shape is the source shape with the reduced axes removed. Optional fastmath flags carry the same floating-point permissions as scalar arithmetic.

Operation contract

Property Value
Semantic phase executable
Traits Pure

Signature

Kind Name Type Cardinality Description
Operand input vector required
Operand init any required
Result result any required
Attribute kind enum CombiningKind required
Attribute fastmath flags FastMathFlags optional
Attribute axes i64_array required

Verification constraints

  • SameType(init, result)
  • SameElementType(input, init, result)

Examples

%cols = vector.reduce.axes<addf> %src, %init axes [0] : vector<4x8xf32>, vector<8xf32>
%sum = vector.reduce.axes<addf> %src, %zero axes [0, 1] : vector<4x8xf32>, f32