ONE
ONE copied to clipboard
[circle-optimizer] Support constant folding of Gather/SparseToDense
What
Let's support constant folding of Gather and SparseToDense.
Why
Reshape Op in onnx model is translated to Gather->SparseToDense->AddV2->Cast in circle.
onnx
circle
A similar pattern was resolved by https://github.com/Samsung/ONE/issues/5598, but the pattern tackled by this issue is slightly different (more specifically, the input shape of SparseToDense
is different).
I think we will face similar issues whenever supporting new models. General constant folding (https://github.com/Samsung/ONE/issues/7129) will significantly reduce the burden of implementing constant folding passes.
CC @seanshpark @llFreetimell
General constant folding (https://github.com/Samsung/ONE/issues/7129) will significantly reduce the burden of implementing constant folding passes.
I agree with this :) If so, we can further expect reduction of logic duplication between luci-interpreter and luci/pass.
Сould you tell me how I can make an onyx model with this pattern or where I can find it? I would like to try to work on this issue :)
The pattern may appear when reshape's shape has a negative value as below.
I've made a small (sliced) tflite model converted from the onnx model.
The final result of the model would be just Transpose
-> Reshape
.
example.zip
It would be nice if this can be added to our tflite recipes.
with tflchef-reverse
tool, we can generate it. (in build/compiler/tflchef/tools/reverse
folder)