Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds support for the "ReduceMean" onnx operation based on https://onnx.ai/onnx/operators/onnx__ReduceMean.html#reducemean-13
The onnx model that I'm trying to load was generated with https://github.com/huggingface/optimum, and that tool generates the version 13 of the "ReduceMean" operation, so I have implemented a version compatible with 13 and below.
There do is a new version 18 with different inputs (
axes
comes as a second input rather than a named attribute), but I have not seen a clear path for switching between the different versions of an operation in order to provide different implementations.A clean way I can imagine of doing is would be to split
candle-onnx/src/eval.rs
into one file per operation, implement all the versions of an operation in each file, and heavily reuse code across versions of the same operation. That would also allow to colocate tests and implementations. It sounds like a big change though...I have also gathered a list of onnx operations that are missing and are needed for my use-case:
Still missing
Sqrt
Range
Greater
Less
Log
Min
Where
Incomplete implementation
ConstantOfShape -> should take "value" attribute into account for selecting the correct DType