Register a Mod handler in aneforge/onnx.py for the case where the divisor is a constant: x - floor(x/c)*c from existing graph ops gives the ONNX integer-Mod (sign follows the divisor); the fmod=1 attribute variant (sign follows the dividend) is x - trunc(x/c)*c, and trunc-toward-zero already exists in the Cast handler as sign(x)*floor(|x|). Reject a tensor divisor loudly.
Handler table via the @onnx_op decorator; test both variants against onnxruntime with positive and negative dividends, following tests/test_onnx.py.
Verifying numerics needs any Apple Silicon Mac (the tests dispatch to the ANE); CI runs only the off-device subset, so state in the PR that the on-device tests passed locally.
Register a
Modhandler inaneforge/onnx.pyfor the case where the divisor is a constant:x - floor(x/c)*cfrom existing graph ops gives the ONNX integer-Mod (sign follows the divisor); thefmod=1attribute variant (sign follows the dividend) isx - trunc(x/c)*c, and trunc-toward-zero already exists in the Cast handler assign(x)*floor(|x|). Reject a tensor divisor loudly.Handler table via the
@onnx_opdecorator; test both variants against onnxruntime with positive and negative dividends, followingtests/test_onnx.py.Verifying numerics needs any Apple Silicon Mac (the tests dispatch to the ANE); CI runs only the off-device subset, so state in the PR that the on-device tests passed locally.