Closed LoipesMas closed 1 year ago
Thanks for contributing to wonnx!
I want to spend more time on it, but life is pretty crazy at the moment.
I genuinely don't know if we will ever have true dynamic sizes
That's a bummer. But, if I understand correctly, we can have "dynamic sizes" between compilations, right? So if we had a video in one resolution, we would compile a session for that resolution and for another video with different resolution we would compile again and have different sizes. And resolution doesn't change between frames, so it should work, correct?
I genuinely don't know if we will ever have true dynamic sizes
That's a bummer. But, if I understand correctly, we can have "dynamic sizes" between compilations, right? So if we had a video in one resolution, we would compile a session for that resolution and for another video with different resolution we would compile again and have different sizes. And resolution doesn't change between frames, so it should work, correct?
Well, yes, if you implement replacing dynamic dimensions with static ones in a model and then infer remaining dimension info (basically re-implement parts of onnxsimplifier). It should not be too hard and could be a useful addition even when only partially implemented.
@LoipesMas you may be very happy with the work done here: https://github.com/webonnx/wonnx/pull/141 :-)
So the Shape operator was already constant-folded during shape inference (in wonnx-preprocessing
) but as of https://github.com/webonnx/wonnx/pull/151/commits/4427198885fef04a65b5f9c16638b61d62435c6d (see #151) it is also implemented at runtime (the optimizer will replace it with a static initializer). Will close this PR after I have added the necessary tests to #151.
Hello! I gave
Shape
operator a try. I pretty much got it working, however there are some small issues:env OP_TESTED=shape pytest tests/test_specific_op.py
) almost pass, but they fail because of different types: it expectsint64
while our output isfloat32
. Not sure how to fix that (output array isi32
and I even tried settingscalar_type
toI64
, but this doesn't help)input_0
in the shader code. but if we don't use it, then it gets removed and then bindings don't check out. I solved this by binding it to unused variable, but there could be a prettier way.P.S. I'll cleanup the code once the other issues are solved ;]