torch.compiler.skip_guard_on_all_nn_modules_unsafe#
- torch.compiler.skip_guard_on_all_nn_modules_unsafe(guard_entries)[source]#
A common function to skip guards on all nn modules, both user defined aswell inbuilt nn modules (like torch.nn.Linear). This is unsafe to use bydefault. But for majority of torch.compile users, the model code does notmodify the nn module attributes. They can benefit from reduction in guardlatency overhead using this API.
To use this API, use guard_filter_fn argument while calling torch.compile
>> opt_mod = torch.compile(>> mod,>> options={“guard_filter_fn”: torch.compiler.skip_guard_on_all_nn_modules_unsafe},>> )