Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dequantizeLinear] ONNX only supports one axis dequantizeLinear #139

Open
lisa0314 opened this issue Feb 17, 2025 · 1 comment
Open

[dequantizeLinear] ONNX only supports one axis dequantizeLinear #139

lisa0314 opened this issue Feb 17, 2025 · 1 comment
Labels

Comments

@lisa0314
Copy link
Collaborator

Consider to add emulation to support multiple axes case, e.g. input shape is [2, 3, 4, 5] and scale shape is [1, 3, 4, 1].

@huningxin huningxin added the ort label Feb 23, 2025
@fdwr
Copy link

fdwr commented Feb 25, 2025

Note blockwise broadcasting via emulation is just a ONNX resampling call (https://onnx.ai/onnx/operators/onnx__Resize.html) with mode "nearest" (treat as nop if there isn't any scaling).

function dequantizeLinear(input:uint8, scale:float32, zeroPoint:uint8)
    upsampledScale = resample(scale, sizes=input.shape)
    upsampledZeroPoint = resample(zeroPoint, sizes=input.shape)
    return mul(sub(input, upsampledZeroPoint).cast(float32), upsampledScale)
endfunction

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants