Ignore a inner function with @torch.compile

Hi all,

I need to torch.compile a function but it cannot be done because an inner function uses complex valued tensors, which are not supported by torch.compile. However, the outputs of this problematic function are floats, so the problem could be solved if I could do something like @torch.compile.ignore to this function.

Do you know any option for this? I have been google’ing and I have not find anything. It could be a nice feature.

This tutorial might be helpful TorchDynamo APIs for fine-grained tracing — PyTorch 2.1 documentation

Depending on your use case you want to go with disable or disallow_in_graph

1 Like