torch.compiler.keep_tensor_guards_unsafe#
- torch.compiler.keep_tensor_guards_unsafe(guard_entries, keep_parameters=False)[source]#
A common function to keep tensor guards on all tensors. This is unsafe to use by default. But if you donโt expect any changes in the model code, you can just keep the tensor guards.
>> opt_mod = torch.compile( >> mod, >> options={โguard_filter_fnโ: torch.compiler.keep_tensor_guards}, >> )