Shortcuts

StatefulSymbolicContext

class torch.fx.experimental.symbolic_shapes.StatefulSymbolicContext(dynamic_sizes, constraint_sizes=None, view_base_context=None, tensor_source=None, shape_env_to_source_to_symbol_cache=None)[source]

Create symbols in create_symbolic_sizes_strides_storage_offset via a symbolic_context determination as given by a cache of Source:Symbol. A cache hit will reuse a stored symbol, and a cache miss will write to this cache.

This behaves like StatelessSymbolicContext, except the cache supersedes the other values - dynamic_sizes and constraint_sizes will not be read if we cache hit.

It is the cache owners responsibility to maintain the lifecycle of the cache w/r/t different shape_envs, clearing, etc.

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