Easy way to create a FakeTensor with dymbolic shape?

Well it is all in the title. I can’t seem to find a way to to create a symbolic shape in a ShapeEnv instance and then a FakeTensor with some of its shapes being symbolic, some not symbolic.

FakeTensorConverter().from_real_tensor seems to apply some logic to identify dimensions as dynamic or not but it is not documented, I wasn’t able to understand its code and adapt it. It would be a lot simpler to just have a function that would look like torch.fake_empty([10, None, 64], shapenv) which creates a symbol for the second dim and returns the FakeTensor instance.

Well I found my answer in pytorch/torch/fx/experimental/shape_inference/infer_shape.py at 1c182627257147158138f88c1d1cfeb5473e5fdd · pytorch/pytorch · GitHub

I hope this part of the API becomes more stable and gets more visibility in the doc.