Summary
pow() currently inherits the element-wise binary contract that requires both inputs to share the same data type. Unlike add/sub/mul — where both operands are the same kind of quantity — a power's base and exponent are conceptually distinct and are commonly different types (e.g. an integer or float32 exponent applied to a float16/int base). The same-type requirement forces redundant casts and rejects valid models.
Current behavior
We are currently encountering the following situation with the model (pow(int64_base, float32_exponent) is rejected at
graph-build time):
Backends status
- ONNX
Pow-15 constrains X (and output) and Y with independent type sets — they need not match. Output type follows X (the base), consistent with WebNN's "output = a's type".
- TFLite
tfl.pow and CoreML MIL elementwise_binary.pow likewise take base/exponent as separate operands.
Proposal and questions
- Give
pow() its own tensor limits
- Should the
b (exponent) be restricted to a small set (e.g. float32 + uint32, TFLite only support tensor of 32-bit float or 32-bit signless integer values), or allowed broadly?
- Should we accept the output based on the input
a (with integer truncation)?
- Give
pow() its own data-type validation
Summary
pow()currently inherits the element-wise binary contract that requires both inputs to share the same data type. Unlikeadd/sub/mul— where both operands are the same kind of quantity — a power's base and exponent are conceptually distinct and are commonly different types (e.g. an integer orfloat32exponent applied to afloat16/intbase). The same-type requirement forces redundant casts and rejects valid models.Current behavior
We are currently encountering the following situation with the model (
pow(int64_base, float32_exponent)is rejected atgraph-build time):
Backends status
Pow-15constrains X (and output) and Y with independent type sets — they need not match. Output type follows X (the base), consistent with WebNN's "output = a's type".tfl.powand CoreML MILelementwise_binary.powlikewise take base/exponent as separate operands.Proposal and questions
pow()its own tensor limitsb(exponent) be restricted to a small set (e.g.float32+uint32, TFLite only support tensor of 32-bit float or 32-bit signless integer values), or allowed broadly?a(with integer truncation)?pow()its own data-type validation