Shortcuts

torch.compiler.assume_constant_result

torch.compiler.assume_constant_result(fn)[source]

This function is used to mark a function fn as having a constant result. This allows the compiler to optimize away your function Returns The same function fn

Parameters

fn – The function to be marked as having a constant result.

Warning

assume_constant_result can if invalid cause safety and soundness issues, torch.compile() will not attempt to validate whether the constant assumption is true or not

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources