Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

The base and exponent of pow() should be allowed to have different data types

Open
#939 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
20/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Quiet

Research direction

This is a spec design question, not a code change: the issue asks whether pow() should get its own tensor data-type limits, separate from the same-type element-wise binary contract. Start with the ONNX Pow-15, TFLite tfl.pow and CoreML elementwise_binary.pow links to compare allowed base and exponent types. Done means the maintainers settle the open questions on exponent types and output type, then the spec text is updated to match.

Written by the indexing model from the issue text.

Description

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):

Image

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
Dominant language
Bikeshed
Stars
566
Forks
72
Avg merge
6d 5h
Merged PRs (30d)
1

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from webmachinelearning/webnn

All issues in webmachinelearning/webnn

Similar issues

More Backend & API Design issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.