The faketensor colab Google Colab has an example of trying maximum batchsize, but it uses concrete shapes with trial and error.
How to create a faketensor with symbolic shape and pass it to a module to get the output symbolic shape?
The documentation Fake tensor — PyTorch 2.1 documentation mentioned ShapeEnv, but I can’t find a simple usage.
ShapeEnv
Might be relevant: @ezyang @albanD @Chillee
This sort of general questions are better suited for the general PyTorch forum https://discuss.pytorch.org/
At any rate, for this and similar questions, it’s always easy to find examples in the testing suite, that is test/. In this case, you can find plenty of examples in test/test_dynamic_shapes.py.
test/
test/test_dynamic_shapes.py
@Lezcano Thanks for the pointer. It is indeed very helpful.