pytorch API reference
400 public APIs from pytorch (pytorch/pytorch) — 131 classes, 208 functions, 61 methods. Signatures extracted by static analysis of the actual source.
Repository: pytorch/pytorch
| Kind | Count |
|---|---|
| Classes | 131 |
| Functions | 208 |
| Methods | 61 |
API list
func
.ci.libtorch.extract_libtorch_from_wheel.copy_bin(torch_dir:Path, libtorch_bin:Path, platform:str) -> NoneCopy binary executables (mainly relevant for Windows).
func
.ci.libtorch.extract_libtorch_from_wheel.copy_libraries(torch_dir:Path, libtorch_lib:Path, platform:str) -> NoneCopy libraries from torch/lib/ to libtorch/lib/.
func
.ci.libtorch.extract_libtorch_from_wheel.get_git_hash(torch_dir:Path) -> strRead git_version from the wheel's torch/version.py.
class
.ci.lumen_cli.cli.lib.common.cli_helper.TargetSpecCLI subcommand specification with bA.
func
.ci.lumen_cli.cli.lib.common.cli_helper.register_targets(parser:argparse.ArgumentParser, target_specs:dict[str, TargetSpec], common_args:Callable[[argparse.ArgumentParser], None]=lambda _: None) -> NoneRegister target subcommands.
func
.ci.lumen_cli.cli.lib.common.docker_helper.local_image_exists(image_name:str, client:docker.DockerClient | None=None) -> boolReturn True if a local Docker image exists.
func
.ci.lumen_cli.cli.lib.common.envs_helper.env_path(name:str, default:str | Path | None=None, resolve:bool=True) -> PathGet environment variable as Path, raise if missing.
func
.ci.lumen_cli.cli.lib.common.envs_helper.env_path_optional(name:str, default:str | Path | None=None, resolve:bool=True) -> Path | NoneGet environment variable as optional Path.
func
.ci.lumen_cli.cli.lib.common.envs_helper.generate_dataclass_help(cls) -> strAuto-generate help text for dataclass fields.
func
.ci.lumen_cli.cli.lib.common.envs_helper.get_env(name:str, default:str='') -> strGet environment variable with default fallback.
func
.ci.lumen_cli.cli.lib.common.gh_summary.md_heading(text:str, level:int=2) -> strGenerate a Markdown heading string with the given level (1-6).
class
.ci.lumen_cli.cli.lib.common.git_helper.PrintProgressSimple progress logger for git operations.
func
.ci.lumen_cli.cli.lib.common.path_helper.copy(src:str | Path, dst:str | Path) -> NoneCopy file or directory from src to dst.
func
.ci.lumen_cli.cli.lib.common.path_helper.ensure_dir_exists(path:str | Path) -> PathCreate directory if it doesn't exist.
func
.ci.lumen_cli.cli.lib.common.path_helper.force_create_dir(path:str | Path) -> PathRemove directory if exists, then create fresh empty directory.
func
.ci.lumen_cli.cli.lib.common.path_helper.get_path(path:str | Path, resolve:bool=False) -> PathConvert to Path object, optionally resolving to absolute path.
func
.ci.lumen_cli.cli.lib.common.path_helper.is_path_exist(path:str | Path | None) -> boolCheck if path exists.
func
.ci.lumen_cli.cli.lib.common.path_helper.remove_dir(path:str | Path | None) -> NoneRemove directory if it exists.
func
.ci.lumen_cli.cli.lib.common.utils.run_command(cmd:str, use_shell:bool=False, log_cmd:bool=True, cwd:str | None=None, env:dict | None=None, check:bool=True) -> intRun a command with optional shell execution.
func
.ci.lumen_cli.cli.lib.common.utils.str2bool(value:str | None) -> boolConvert environment variables to boolean values.
class
.ci.lumen_cli.cli.lib.core.vllm.vllm_build.VllmBuildRunnerBuild vLLM using docker buildx.
func
.ci.manywheel.build_env_setup.discover_rocm_home() -> strLocate the ROCm install root.
class
.ci.manywheel.repair_wheel.AuxFileAuxiliary content (e.g.
func
.ci.manywheel.repair_wheel.aarch64_extra_deps(use_cuda:bool) -> list[Path]Libraries to bundle into torch/lib/ on aarch64.
func
.ci.manywheel.repair_wheel.cuda_rpaths(gpu_arch_version:str) -> strBuild the colon-separated RPATH list for CUDA wheels.
func
.ci.manywheel.repair_wheel.rocm_os_deps() -> list[Path]OS-side runtime deps that must travel with ROCm wheels.
func
.ci.manywheel.repair_wheel.rocm_rpaths() -> strRPATH list for the TheRock wheel-based ROCm layout.
func
.ci.manywheel.repair_wheel.wheel_platform_tags(wheel_name:str) -> list[str]Platform tags encoded in a wheel filename.
func
.ci.pytorch.windows._common.download(url:str, dest:Path, attempts:int=5) -> NoneStream `url` to `dest`, retrying with exponential backoff.
func
.ci.pytorch.windows._common.write_env_exports(env:dict[str, str], path:Path | None) -> NoneWrite `export KEY=VALUE` lines for build.sh to source.
func
.ci.pytorch.windows.build_env_setup.capture_vcvars_env(vcvarsall:Path, args:str) -> dict[str, str]Capture the env diff produced by `vcvarsall.bat <args>`.
func
.ci.pytorch.windows.build_env_setup.find_cuda_path(dotted_version:str) -> PathFind the CUDA install root for the requested dotted version.
func
.ci.pytorch.windows.build_env_setup.find_nvtoolsext() -> PathMirror internal/check_nvtx.bat.
func
.ci.pytorch.windows.build_env_setup.find_vcvarsall(vc_year:str) -> PathLocate vcvarsall.bat via vswhere.exe.
func
.spin.cmds.develop()Build PyTorch (editable install).
func
.spin.cmds.docs(make_args)Build documentation.
func
.spin.cmds.fixlint(ctx, *lintrunner_args, **kwargs)Autofix all files.
func
.spin.cmds.infer(files)Infer type annotations using `pyrefly infer`.
func
.spin.cmds.install()Install PyTorch (non-editable).
func
.spin.cmds.lint(ctx, *lintrunner_args, *apply_patches, **kwargs)Lint all files.
func
.spin.cmds.quickfix(ctx, *lintrunner_args, **kwargs)Autofix changed files.
func
.spin.cmds.quicklint(ctx, *lintrunner_args, *apply_patches, **kwargs)Lint changed files.
func
.spin.cmds.regenerate_clangtidy_files()Regenerate clang-tidy files.
func
.spin.cmds.regenerate_type_stubs()Regenerate type stubs.
func
.spin.cmds.regenerate_version()Regenerate version.py.
func
.spin.cmds.setup_lint()Set up lintrunner with current CI version.
func
aten.src.ATen.native.transformers.hip.flash_attn.ck.fav_v3.generate_aiter_embedded_hsa.sanitize_identifier(name:str) -> strConvert a file path to a valid C++ identifier.
class
functorch.dim.DotPartHelper class for organizing dimensions in dot products.
method
functorch.dim.DotPart.append(dim_entry:Any) -> NoneAdd a dimension entry to this part.
method
functorch.dim.Tensor.order(*dims:Any) -> _TensorReorder the dimensions of this tensor.
func
functorch.dim._getsetitem.has_dims(obj:Any) -> boolCheck if an object has first-class dimensions.
func
functorch.dim._getsetitem.setitem(self:Any, index:Any, rhs:Any) -> NoneSet values in tensor using first-class dimensions.
func
functorch.dim._order.append_dim(d:DimEntry) -> NoneAdd a dimension to the reordering, removing it from available levels.
func
functorch.dim._wrap.handle_from_tensor(tensor:torch.Tensor) -> torch.TensorHandle tensor conversion for torch function integration.
func
functorch.dim.dimlists(n:int | None=None, sizes:list[int | None] | None=None) -> DimList | tuple[DimList, ...]Create and return one or more DimList objects.
func
functorch.dim.dims(n:int | None=None, sizes:list[int | None] | None=None) -> Dim | tuple[Dim, ...]Create and return one or more Dim objects.
func
functorch.dim.dot(lhs:Any, rhs:Any, sum_dims:Any) -> _Tensor | torch.TensorPerform dot product between two tensors along specified dimensions.
func
functorch.dim.dot_finish(parts:list[DotPart], result_tensor:torch.Tensor) -> TensorFinish dot product by reshaping result and creating Tensor.
func
functorch.dim.dot_prepare(parts:list[DotPart], tensor_info:TensorInfo) -> torch.TensorPrepare tensor for dot product by matching levels and reshaping.
func
functorch.dim.handle_from_tensor(tensor:torch.Tensor) -> torch.TensorHandle tensor conversion for torch function integration.
func
functorch.dim.index(self:Any, positions:Any, dims:Any) -> _TensorIndex a regular tensor by binding specified positions to dims.
func
functorch.dim.insert_dim(d:Any, lhs_idx:Any, rhs_idx:Any) -> NoneInsert dimension into appropriate part based on stride pattern.
func
functorch.dim.split(tensor:Any, split_size_or_sections:Any, dim:Any=None) -> tupleSplit tensor along a dimension.
func
functorch.dim.stack(tensors:Any, new_dim:Any, dim:int=0) -> _TensorStack tensors along a new dimension.
func
torch.__config__.parallel_info() -> strReturns detailed string with parallelization settings
class
torch._appdirs.AppDirsConvenience wrapper for getting application dirs.
method
torch._custom_op.impl.CustomOp.impl_factory() -> typing.CallableRegister an implementation for a factory function.
func
torch._dynamo.backends.common.fake_tensor_unsupported(fn:Callable[[Any, list[Any], Any], R]) -> AnyDecorator for backends that need real inputs.
func
torch._dynamo.backends.registry.lookup_backend(compiler_fn:str | CompilerFn) -> CompilerFnExpand backend strings to functions
func
torch._dynamo.bytecode_analysis.remove_dead_code(instructions:list['Instruction']) -> list['Instruction']Dead code elimination
func
torch._dynamo.bytecode_analysis.remove_pointless_jumps(instructions:list['Instruction']) -> list['Instruction']Eliminate jumps to the next instruction
class
torch._dynamo.bytecode_debugger.DebuggerStatePer-frame debugging state.
func
torch._dynamo.bytecode_debugger.breakpoint() -> NoneProgrammatic breakpoint for user code.
func
torch._dynamo.bytecode_debugger.debug() -> Generator[_DebugContext, None, None]Context manager for debugging Dynamo-generated bytecode.
class
torch._dynamo.bytecode_transformation.InstructionA mutable version of dis.Instruction
func
torch._dynamo.bytecode_transformation.assemble(instructions:list[Instruction], firstlineno:int) -> tuple[bytes, bytes]Do the opposite of dis.get_instructions()
func
torch._dynamo.bytecode_transformation.debug_checks(code:types.CodeType) -> NoneMake sure our assembler produces same bytes as we start with
func
torch._dynamo.bytecode_transformation.decode_exception_table_varint(bytes_iter:Iterator[int]) -> intInverse of `encode_exception_table_varint`.
func
torch._dynamo.bytecode_transformation.explicit_super(code:types.CodeType, instructions:list[Instruction]) -> Noneconvert super() with no args into explicit arg form
func
torch._dynamo.bytecode_transformation.fix_extended_args(instructions:list[Instruction]) -> intFill in correct argvals for EXTENDED_ARG ops
func
torch._dynamo.bytecode_transformation.pop() -> NonePop the key_stack and append an exception table entry if possible.
func
torch._dynamo.bytecode_transformation.virtualize_jumps(instructions:Iterable[Instruction]) -> NoneReplace jump targets with pointers to make editing easier
func
torch._dynamo.cache_size.exceeds_recompile_limit(cache_size:CacheSizeRelevantForFrame, compile_id:CompileId) -> tuple[bool, str]Checks if we are exceeding the cache size limit.
class
torch._dynamo.codegen.PyCodegenHelper class uses for constructing Python bytecode
method
torch._dynamo.codegen.PyCodegen.load_function_name(fn_name:str, push_null:bool, num_on_stack:int=0) -> list[Instruction]Load the global fn_name on the stack num_on_stack down
method
torch._dynamo.codegen.PyCodegen.make_call_generated_code(fn_name:str) -> NoneCall the generated code function stored in fn_name
method
torch._dynamo.codegen.PyCodegen.make_function_with_closure(fn_name:str, code:types.CodeType) -> NoneCreates a closure with code object `code`.
method
torch._dynamo.codegen.PyCodegen.mark_source_temp(source:Source) -> NoneMark a source as a temp variable, so that it can be reused.
method
torch._dynamo.codegen.PyCodegen.setup_globally_cached(name:str, value:Any) -> list[Instruction]Store value in a new global
class
torch._dynamo.convert_frame.GraphCaptureOutputMinimal version of DynamoOutput
func
torch._dynamo.convert_frame.has_tensor(obj:object) -> boolRecursively check if the obj has a tensor
func
torch._dynamo.convert_frame.has_tensor_in_frame(frame:DynamoFrameType) -> boolCheck if the frame has torch.* related bits
func
torch._dynamo.convert_frame.register_bytecode_hook(hook:BytecodeHook) -> RemovableHandleRegister hooks for bytecode generated by Dynamo.
func
torch._dynamo.dce_extra_outputs.dce_hop_extra_outputs(gm:torch.fx.GraphModule) -> boolRemove unused extra outputs from HOP calls in all submodules.
class
torch._dynamo.debug_utils.TensorContainerContainer for tensors as attributes
func
torch._dynamo.debug_utils.clone_inputs_retaining_gradness(example_inputs:Sequence[Any]) -> list[Any]This clone inputs is different from utils clone_input.
func
torch._dynamo.decorators.graph_break(msg:str='') -> NoneForce a graph break
func
torch._dynamo.decorators.nonstrict_trace(traceable_fn:Callable[_P, _R]) -> Callable[_P, _R]Decorator to mark a function as nonstrict-traceable for dynamo.
func
torch._dynamo.decorators.override_optimization_hint(x:Any, val:int) -> NoneOverride the optimization hint for a scalar unbacked symbol.
func
torch._dynamo.decorators.run(fn:Callable[_P, _R] | None=None) -> AnyDon't do any dynamic compiles, just use prior optimizations
func
torch._dynamo.decorators.skip_frame(msg:str='') -> NoneForce a skipped frame
class
torch._dynamo.device_interface.DeviceInterfaceThis is a simple device runtime interface for Inductor.
method
torch._dynamo.dynamo_profiler.DynamoProfilerState.get_timings() -> list[FunctionTraceTiming]Get all recorded timings.
method
torch._dynamo.dynamo_profiler.DynamoProfilerState.pop() -> ProfilerStackEntry | NonePop the top entry from the timing stack.
method
torch._dynamo.dynamo_profiler.DynamoProfilerState.push(func_name:str, filename:str, firstlineno:int, start_time_ns:int) -> NonePush a new entry onto the timing stack.
method
torch._dynamo.dynamo_profiler.DynamoProfilerState.record_timing(timing:FunctionTraceTiming) -> NoneRecord timing data for a traced function.
class
torch._dynamo.dynamo_profiler.FunctionTraceTimingTiming data for a single inlined function trace.
func
torch._dynamo.eval_frame.remove_from_cache(f:Any) -> NoneMake sure f.__code__ is not cached to force a recompile
class
torch._dynamo.exc.CondOpArgsMismatchErrorInternal error from cond() due to arguments mismatch.
class
torch._dynamo.exc.TorchDynamoExceptionBase exception class for all TorchDynamo-specific exceptions.
func
torch._dynamo.exc.raise_type_error(tx:InstructionTranslatorBase, msg:str) -> NoReturnRaise a TypeError as an observed exception during tracing.
func
torch._dynamo.exc.raise_value_error(tx:InstructionTranslatorBase, msg:str) -> NoReturnRaise a ValueError as an observed exception during tracing.
func
torch._dynamo.exc.unimplemented(*gb_type:str, *context:str, *explanation:str, *hints:list[str], *from_exc:Any=_NOTHING, *log_warning:bool=False, *skip_frame:bool=False) -> NoReturnCalled within dynamo to cause a graph break.
func
torch._dynamo.external_utils.insert_const_values_with_mask(tup:tuple[Any, ...], masks:list[bool], values:tuple[Any, ...]) -> tuple[Any, ...]masks and values are of same length.
func
torch._dynamo.external_utils.wrap_dunder_call_ctx_manager(self:Any, func:Callable[_P, _R]) -> Callable[_P, _R]Apply self as a ctx manager around a call to func
func
torch._dynamo.external_utils.wrap_inline(fn:Callable[_P, _R]) -> Callable[_P, _R]Create an extra frame around fn that is not in skipfiles.
func
torch._dynamo.functional_export.clean_export_root(graph_module:torch.fx.GraphModule) -> NoneRemove export_root artifacts from FX graph in-place
func
torch._dynamo.functional_export.clean_export_root_string(text:str) -> strGeneric utility to clean export_root patterns from strings.
class
torch._dynamo.graph_id_filter.GraphBackendRouterRoutes graphs to different backends based on their IDs.
func
torch._dynamo.graph_id_filter.get_backend_override_for_compile_id(compile_id:CompileId | None, config_str:str) -> AnyGet the backend override for a given CompileId.
class
torch._dynamo.graph_region_tracker.RegionWrapperHolds state for regions e.g.
class
torch._dynamo.guards.GuardManagerWrapperA helper class that contains the root guard manager.
class
torch._dynamo.guards.UnsupportedGuardCheckSpecSentinel for guards with no check spec yet.
func
torch._dynamo.guards.install_guard(*skip:int=0, *guards:Guard) -> NoneAdd dynamo guards to the current tracing context.
func
torch._dynamo.guards.strip_local_scope(s:str) -> strReplace occurrences of L[...] with just the inner content.
method
torch._dynamo.metrics_context.MetricsContext.add_to_set(metric:str, value:Any) -> NoneRecords a metric as a set() of values.
method
torch._dynamo.metrics_context.MetricsContext.add_top_n(metric:str, key:Any, val:int) -> NoneRecords a metric as a TopN set of values.
method
torch._dynamo.metrics_context.MetricsContext.in_progress() -> boolTrue if we've entered the context.
method
torch._dynamo.metrics_context.MetricsContext.increment(metric:str, value:int) -> NoneIncrement a metric by a given amount.
method
torch._dynamo.metrics_context.MetricsContext.set(metric:str, value:Any, overwrite:bool=False) -> NoneSet a metric to a given value.
method
torch._dynamo.metrics_context.MetricsContext.update(values:dict[str, Any], overwrite:bool=False) -> NoneSet multiple metrics directly.
method
torch._dynamo.metrics_context.MetricsContext.update_outer(values:dict[str, Any]) -> NoneUpdate, but only when at the outermost context.
func
torch._dynamo.mutation_guard.is_dynamic_nn_module(obj:Any, is_export:bool) -> boolCheck for nn.Modules() created dynamically or mutated
func
torch._dynamo.mutation_guard.watch(obj:Any, guarded_code:Any) -> Noneinvalidate guarded_code when obj is mutated
class
torch._dynamo.output_graph.FakeRootModuleTrick the constructor of fx.GraphModule
class
torch._dynamo.output_graph.GraphCompileReasonStores why a given output graph was compiled; i.e.
class
torch._dynamo.output_graph.OutputGraphWrapper class to hold outputs of InstructionTranslator.
method
torch._dynamo.output_graph.OutputGraph.bypass_package(reason:str='', **kwargs:Any) -> NoneDo not save this output graph to the CompilePackage
method
torch._dynamo.output_graph.OutputGraph.example_value_from_input_node(node:torch.fx.Node) -> AnyExtract the non-fake example tensor
method
torch._dynamo.output_graph.OutputGraph.install_global(prefix:str, value:Any) -> strInstalls a global, generating a unique name for it.
method
torch._dynamo.output_graph.OutputGraph.install_global_by_id(prefix:str, value:Any) -> strInstalls a global if it hasn't been installed already.
method
torch._dynamo.output_graph.OutputGraph.install_global_unsafe(name:str, value:Any) -> NoneWARNING: prefer the safer `install_global_by_id/install_global`.
method
torch._dynamo.output_graph.OutputGraph.install_resume_function_global(name:str, code:types.CodeType, f_globals:dict[str, Any]) -> NoneInstall a resume function as a global.
method
torch._dynamo.output_graph.OutputGraph.save_global_state(out:dict[str, tuple[Callable[..., Any], bool]] | None=None) -> NoneSaves to out if it is provided.
method
torch._dynamo.output_graph.OutputGraph.update_co_names(name:str) -> NoneEnsure self.code_options.co_names contains name
class
torch._dynamo.output_graph.OutputGraphCommonA minimal interface for full graph capture.
class
torch._dynamo.output_graph.SubgraphTracerHolds an FX graph that is being traced.
method
torch._dynamo.output_graph.SubgraphTracer.maybe_lift_tracked_freevar_to_input(arg:Any) -> AnyIf arg is a free variable, then lift it to be an input.
class
torch._dynamo.package.SystemInfoSystem information including Python, PyTorch, and GPU details.
func
torch._dynamo.polyfills.copy.reduce_ex_user_defined_object(obj:T, protocol:int) -> tupleTraceable polyfill for object.__reduce_ex__ (protocol >= 2).
func
torch._dynamo.polyfills.list_cmp(op:Callable[[Any, Any], bool], left:Sequence[T], right:Sequence[T]) -> boolemulate `(1,2,3) > (1,2)` etc
class
torch._dynamo.polyfills.pytree.PyTreeSpecAnalog for :class:`optree.PyTreeSpec` in Python.
func
torch._dynamo.repro.after_aot.setup_fake_process_groups(group_info:dict[str, GroupInfo]) -> NoneSet up fake process groups for repro execution.
func
torch._dynamo.repro.after_dynamo.dump_backend_repro_as_file(gm:torch.fx.GraphModule, args:Sequence[Any], compiler_name:str | None, check_accuracy:bool=False) -> NoneSaves the repro to a repro.py file
func
torch._dynamo.repro.after_dynamo.dump_backend_state(gm:torch.fx.GraphModule, args:Sequence[Any], compiler_name:str | None, check_accuracy:bool=False) -> NoneDumps the dynamo graph to repro the issue.
func
torch._dynamo.reset() -> NoneClear all compile caches and restore initial state.
func
torch._dynamo.set_recursion_limit(limit:int) -> NoneSets an internal dynamo recursion limit.
class
torch._dynamo.symbolic_convert.InliningInstructionTranslatorTrace and inline a called method
func
torch._dynamo.symbolic_convert.profile_inline_call(output:OutputGraph, code:types.CodeType, get_inline_depth:Callable[[], int]) -> Generator[None, None, None]Context manager for profiling inline calls.
func
torch._dynamo.testing.debug_insert_nops(frame:DynamoFrameType, cache_size:int, hooks:Any, _:Any, *skip:int=0) -> ConvertFrameReturnused to debug jump updates
func
torch._dynamo.testing.empty_line_normalizer(code:str) -> strNormalize code: remove empty lines.
func
torch._dynamo.trace_rules.add_module_init_func(name:str, init_func:Callable[[], None]) -> NoneRegister a module without eagerly importing it
func
torch._dynamo.trace_rules.check_file(filename:str | None, is_inlined_call:bool=False) -> SkipResultShould skip this file?
func
torch._dynamo.trace_rules.get_skip_reason(obj:object) -> strCompute a descriptive skip reason for a callable.
class
torch._dynamo.utils.ChromiumEventLoggerLogs chromium events to structured logs.
method
torch._dynamo.utils.ChromiumEventLogger.get_outermost_event() -> str | NoneGet the outermost event name (i.e.
method
torch._dynamo.utils.ChromiumEventLogger.get_stack() -> list[str]The main event stack, with every chromium event.
method
torch._dynamo.utils.ChromiumEventLogger.increment(event_name:str, key:str, value:int) -> NoneIncrement an integer event data field by the given amount
method
torch._dynamo.utils.ChromiumEventLogger.log_event_end(event_name:str, time_ns:int, metadata:dict[str, Any], start_time_ns:int, log_pt2_compile_event:bool, compile_id:CompileId | None=None) -> NoneLogs the end of a single event.
method
torch._dynamo.utils.ChromiumEventLogger.log_event_start(event_name:str, time_ns:int, metadata:dict[str, Any], log_pt2_compile_event:bool=False, compile_id:CompileId | None=None) -> NoneLogs the start of a single event.
class
torch._dynamo.utils.CleanupHookRemove a global variable when hook is called
class
torch._dynamo.utils.CompileEventLoggerHelper class for representing adding metadata(i.e.
method
torch._dynamo.utils.CompileEventLogger.add_record_function_data(event_name:str, **metadata:object) -> NoneAdd record function data to the profiler event.
method
torch._dynamo.utils.CompileEventLogger.add_toplevel(log_level:CompileEventLogLevel, overwrite:bool=False, **metadata:object) -> NoneSyntactic sugar for logging to the toplevel event
method
torch._dynamo.utils.CompileEventLogger.chromium(event_name:str, **metadata:object) -> NoneAdd <metadata> to <event_name> in chromium.
method
torch._dynamo.utils.CompileEventLogger.compilation_metric(overwrite:bool=False, **metadata:object) -> NoneAdd <metadata> to the CompilationMetrics context.
method
torch._dynamo.utils.CompileEventLogger.increment(event_name:str, log_level:CompileEventLogLevel, key:str, value:int) -> NoneIncrements an existing field, or adds it
method
torch._dynamo.utils.CompileEventLogger.increment_toplevel(key:str, value:int=1, log_level:CompileEventLogLevel=CompileEventLogLevel.COMPILATION_METRIC) -> NoneIncrements a value on the toplevel metric.
class
torch._dynamo.utils.StripAnsiFormatterLogging formatter that strips ANSI escape codes.
func
torch._dynamo.utils.clone_input(x:torch.Tensor, *dtype:torch.dtype | None=None) -> torch.Tensorcopy while preserving strides
func
torch._dynamo.utils.clone_tensor(x:torch.Tensor) -> torch.TensorClone the tensor and its gradient
func
torch._dynamo.utils.copy_dynamo_tensor_attributes(src:torch.Tensor, dst:torch.Tensor) -> NoneCopy dynamo-specific tensor attributes from src to dst.
func
torch._dynamo.utils.fqn(obj:Any) -> strReturns the fully qualified name of the object.
func
torch._dynamo.utils.get_instruction_source_311(code:types.CodeType, inst:Instruction) -> strPython 3.11+ only.
func
torch._dynamo.utils.import_submodule(mod:types.ModuleType) -> NoneEnsure all the files in a given submodule are imported
func
torch._dynamo.utils.is_pybind11_enum_member(value:object) -> boolCheck if value is a pybind11 enum member (with stable hash and eq).
func
torch._dynamo.utils.is_torch_class(cls:type) -> boolCheck if cls is defined in torch or a torch submodule.
func
torch._dynamo.utils.istensor(obj:Any) -> boolCheck of obj is a tensor
func
torch._dynamo.utils.key_is_id(k:Any) -> TypeIs[torch.Tensor | torch.nn.Module | MethodWrapperType]Returns whether it indexes dictionaries using its id
func
torch._dynamo.utils.numpy_to_tensor(value:Any) -> AnyConvert tnp.ndarray to tensor, leave other types intact.
func
torch._dynamo.utils.register_hook_for_recompile_user_context(hook:Callable[[], str]) -> NoneRegister a hook to be called when a recompile is triggered.
func
torch._dynamo.utils.rmse(ref:torch.Tensor, res:torch.Tensor) -> torch.TensorCalculate root mean squared error
func
torch._dynamo.utils.run_node(tracer:Any, node:torch.fx.Node, args:Any, kwargs:Any, nnmodule:Any) -> AnyRuns a given node, with the given args and kwargs.
func
torch._dynamo.utils.set_feature_use(feature:str, usage:bool) -> NoneRecords whether we are using a feature Generally a feature is a JK.
func
torch._dynamo.utils.to_numpy_helper(value:Any) -> AnyConvert tensor and tnp.ndarray to numpy.ndarray.
class
torch._dynamo.variables.base.GetSet`tp_getset` entry, analogous to CPython's PyGetSetDef.
class
torch._dynamo.variables.base.Member`tp_members` entry, analogous to CPython's PyMemberDef.
class
torch._dynamo.variables.base.MutationTypeBase class for Variable.mutation_type.
class
torch._dynamo.variables.base.SlotGroupA CPython slot group.
class
torch._dynamo.variables.base.ValueMutationNewThis case of VariableTracker.mutation_type marker indicates 1.
class
torch._dynamo.variables.builder.VariableBuilderWrap a python value in a VariableTracker() instance
class
torch._dynamo.variables.builtin.DictBuiltinVariableVariable tracker for the `dict` builtin constructor.
class
torch._dynamo.variables.builtin.GetAttrBuiltinVariableVariable tracker for the `getattr` builtin.
class
torch._dynamo.variables.builtin.HasAttrBuiltinVariableVariable tracker for the `hasattr` builtin.
class
torch._dynamo.variables.builtin.IterBuiltinVariableVariable tracker for the `iter` builtin.
class
torch._dynamo.variables.builtin.ListBuiltinVariableVariable tracker for the `list` builtin constructor.
class
torch._dynamo.variables.builtin.SetAttrBuiltinVariableVariable tracker for the `setattr` builtin.
class
torch._dynamo.variables.ctx_manager.AcceleratorDeviceIndexVariablerepresents torch.accelerator.device_index
class
torch._dynamo.variables.ctx_manager.CUDADeviceVariablerepresents torch.cuda.device
class
torch._dynamo.variables.ctx_manager.CatchWarningsCtxManagerVariableDelay a call to warnings.catch_warnings
class
torch._dynamo.variables.ctx_manager.CudagraphOverrideVariablerepresents torch._dynamo.override_cudagraphs
class
torch._dynamo.variables.ctx_manager.DynamoConfigPatchVariablerepresents torch._dynamo.patch_dynamo_config
class
torch._dynamo.variables.ctx_manager.ErrorOnGraphBreakVariablerepresents torch._dynamo.error_on_graph_break
class
torch._dynamo.variables.ctx_manager.GradInplaceRequiresGradCtxManagerVariablerepresents torch grad requires grad
class
torch._dynamo.variables.ctx_manager.GradModeVariablerepresents torch.{no_grad,enable_grad,set_grad_mode}()
class
torch._dynamo.variables.ctx_manager.NullContextVariableThis class represents Python contextlib.nullcontext.
class
torch._dynamo.variables.ctx_manager.SDPAKernelVariablerepresents torch.nn.attention.sdpa_kernel
class
torch._dynamo.variables.ctx_manager.XPUDeviceVariablerepresents torch.xpu.device
class
torch._dynamo.variables.dicts.DictViewVariableModels _PyDictViewObject This is an "abstract" class.
method
torch._dynamo.variables.dicts.DictViewVariable.sq_length(tx:'InstructionTranslatorBase') -> VariableTrackerSequence length for dict view objects.
class
torch._dynamo.variables.dicts.DunderDictVariablerepresents object.__dict__
class
torch._dynamo.variables.functions.BoundBuiltinMethodVariableBound builtin_function_or_method (PyCFunction_Type).
class
torch._dynamo.variables.functions.ClassMethodVariableclassmethod descriptor wrapping a callable.
class
torch._dynamo.variables.functions.ContextlibContextManagerLocalGeneratorObjectVariable..
class
torch._dynamo.variables.functions.FunctionDecoratedByContextlibContextManagerVariable..
class
torch._dynamo.variables.functions.LocalGeneratorFunctionVariablefunctions that behaves like iterators ..
class
torch._dynamo.variables.functions.PropertyVariablePython property descriptor.
class
torch._dynamo.variables.functions.StaticMethodVariablestaticmethod descriptor wrapping a callable.
class
torch._dynamo.variables.functions.UserFunctionVariableSome unsupported user-defined global function
class
torch._dynamo.variables.functions.UserMethodVariableSome unsupported user-defined method
class
torch._dynamo.variables.higher_order_ops.SubgraphTracingInfoProperties observed during subgraph tracing.
func
torch._dynamo.variables.higher_order_ops.get_tensor_storages(tensor:torch.Tensor) -> set[StorageWeakRef]Get storage references from a tensor.
class
torch._dynamo.variables.invoke_subgraph.LiftedCapturedSourceLifted arg that is a captured variable (e.g.
func
torch._dynamo.variables.invoke_subgraph.classify_vt(vt:Any) -> InputTag | NoneReturn the tag for a leaf VT, or None if unsupported.
func
torch._dynamo.variables.invoke_subgraph.get_flat_proxies(fingerprint:InputFingerprint) -> list[Proxy]Collect deduplicated proxies from tensor/symnode leaves.
func
torch._dynamo.variables.invoke_subgraph.sym_num_key(sym_num:Any) -> AnyKey for matching a symbolic input against a cached one.
class
torch._dynamo.variables.iter.FilterVariableRepresents filter(fn, iterable)
class
torch._dynamo.variables.iter.MapVariableRepresents map(fn, *iterables)
class
torch._dynamo.variables.iter.ZipVariableRepresents zip(*iterables)
class
torch._dynamo.variables.lazy.ComputedLazyConstantVariableResult of a supported op over lazy constant operands.
class
torch._dynamo.variables.lazy.LazyCacheContainer to cache the real VariableTracker
method
torch._dynamo.variables.lazy.LazyVariableTracker.realize() -> VariableTrackerForce construction of the real VariableTracker
class
torch._dynamo.variables.lists.SizeVariabletorch.Size(...)
class
torch._dynamo.variables.memory.CUDAMemPoolVariableRepresents a torch.cuda.MemPool object.
class
torch._dynamo.variables.misc.AutogradEngineVariableRepresents a torch._C._ImperativeEngine instance.
class
torch._dynamo.variables.misc.AutogradFunctionVariablerepresents a torch.autograd.Function subclass
class
torch._dynamo.variables.misc.CallMethodVariableA method bound to a VT instance.
class
torch._dynamo.variables.misc.ConstantLikeVariableself.value is a compile-time constant, but not a literal
class
torch._dynamo.variables.misc.ContextVarVariableWraps a contextvars.ContextVar for Dynamo tracing.
class
torch._dynamo.variables.misc.DeletedVariableMarker used to implement delattr()
class
torch._dynamo.variables.misc.LoggingLoggerVariableRepresents a call to any logging.Logger methods.
class
torch._dynamo.variables.misc.NumpyVariableWrapper around `numpy.*`.
class
torch._dynamo.variables.misc.RandomClassVariablerandom.Random
class
torch._dynamo.variables.misc.UnknownVariableIt could be anything!
class
torch._dynamo.variables.nn_module.UnspecializedBuiltinNNModuleVariableDifferentiates between builtin nn modules (e.g.
func
torch._dynamo.variables.object_protocol.generic_hash_impl(tx:'InstructionTranslatorBase', obj:VariableTracker) -> tuple[int, bool]Internal API: compute hash as (value, is_fake).
func
torch._dynamo.variables.object_protocol.generic_is_true(tx:'InstructionTranslatorBase', obj:VariableTracker) -> VariableTrackerMirrors PyObject_IsTrue.
func
torch._dynamo.variables.object_protocol.generic_richcompare(tx:'InstructionTranslatorBase', v:VariableTracker, w:VariableTracker, op:str) -> VariableTrackerDynamo's do_richcompare.
func
torch._dynamo.variables.object_protocol.generic_str(tx:'InstructionTranslatorBase', obj:'VariableTracker') -> 'VariableTracker'Mirrors PyObject_Str semantics in Dynamo.
func
torch._dynamo.variables.object_protocol.mro_lookup(py_type:type, name:str) -> objectWalk py_type.__mro__ to find *name* in the class hierarchy.
func
torch._dynamo.variables.object_protocol.object_generic_getattr(tx:'InstructionTranslatorBase', obj:VariableTracker, name:str) -> VariableTrackerDynamo's PyObject_GenericGetAttr.
func
torch._dynamo.variables.object_protocol.object_richcompare(self:VariableTracker, tx:'InstructionTranslatorBase', other:VariableTracker, op:str) -> VariableTrackerobject's tp_richcompare.
func
torch._dynamo.variables.object_protocol.pycallable_check(obj_type:type) -> boolImplements PyCallable_Check: type(x)->tp_call != NULL.
func
torch._dynamo.variables.object_protocol.pyindex_check(obj_type:type) -> boolImplements _PyIndex_Check semantics for VariableTracker objects.
func
torch._dynamo.variables.object_protocol.pynumber_absolute(tx:'InstructionTranslatorBase', obj:VariableTracker) -> VariableTrackerMirrors PyNumber_Absolute.
func
torch._dynamo.variables.object_protocol.pynumber_float(tx:'InstructionTranslatorBase', obj:VariableTracker) -> VariableTrackerMirrors PyNumber_Float (float(x) dispatch).
func
torch._dynamo.variables.object_protocol.pynumber_index(tx:'InstructionTranslatorBase', obj:VariableTracker) -> 'VariableTracker'Mirrors PyNumber_Index (index(x) dispatch).
func
torch._dynamo.variables.object_protocol.pynumber_inplace_multiply(tx:'InstructionTranslatorBase', v:VariableTracker, w:VariableTracker) -> VariableTrackerMirrors CPython's PyNumber_InPlaceMultiply.
func
torch._dynamo.variables.object_protocol.pynumber_int(tx:'InstructionTranslatorBase', obj:VariableTracker) -> VariableTrackerMirrors PyNumber_Long (int(x) dispatch).
func
torch._dynamo.variables.object_protocol.pynumber_invert(tx:'InstructionTranslatorBase', obj:VariableTracker) -> VariableTrackerMirrors PyNumber_Invert.
func
torch._dynamo.variables.object_protocol.pynumber_matrix_multiply(tx:'InstructionTranslatorBase', v:VariableTracker, w:VariableTracker) -> VariableTrackerMirrors CPython's PyNumber_MatrixMultiply.
func
torch._dynamo.variables.object_protocol.pynumber_multiply(tx:'InstructionTranslatorBase', v:VariableTracker, w:VariableTracker) -> VariableTrackerMirrors CPython's PyNumber_Multiply.
func
torch._dynamo.variables.object_protocol.pynumber_negative(tx:'InstructionTranslatorBase', obj:VariableTracker) -> VariableTrackerMirrors PyNumber_Negative.
func
torch._dynamo.variables.object_protocol.pynumber_positive(tx:'InstructionTranslatorBase', obj:VariableTracker) -> VariableTrackerMirrors PyNumber_Positive.
func
torch._dynamo.variables.object_protocol.pysequence_inplace_repeat(tx:'InstructionTranslatorBase', seq:VariableTracker, n:VariableTracker) -> VariableTrackerpysequence_repeat using sq_inplace_repeat.
func
torch._dynamo.variables.object_protocol.pysequence_repeat(tx:'InstructionTranslatorBase', seq:VariableTracker, n:VariableTracker) -> VariableTrackerMirrors CPython's sequence_repeat helper.
func
torch._dynamo.variables.object_protocol.slot_wrapper_iadd(tx:'InstructionTranslatorBase', self:VariableTracker, other:VariableTracker) -> VariableTracker``self.__iadd__(other)`` slot wrapper.
func
torch._dynamo.variables.object_protocol.slot_wrapper_imul(tx:'InstructionTranslatorBase', self:VariableTracker, other:VariableTracker) -> VariableTracker``self.__imul__(other)`` slot wrapper.
func
torch._dynamo.variables.object_protocol.type_implements_mp_slot(obj_type:type, slot:int) -> boolCheck whether obj_type implements the given mp slot.
func
torch._dynamo.variables.object_protocol.type_implements_nb_slot(obj_type:type, slot:int) -> boolCheck whether obj_type implements the nb slot.
func
torch._dynamo.variables.object_protocol.type_implements_sq_slot(obj_type:type, slot:int) -> boolCheck whether obj_type implements the given sq slot.
func
torch._dynamo.variables.object_protocol.type_implements_tp_call(obj_type:type) -> boolCheck whether obj_type implements the tp_call slot.
func
torch._dynamo.variables.object_protocol.type_implements_tp_repr(obj_type:type) -> boolCheck whether obj_type implements the tp_repr slot.
func
torch._dynamo.variables.object_protocol.type_implements_tp_str(obj_type:type) -> boolCheck whether obj_type implements the tp_str slot.
func
torch._dynamo.variables.object_protocol.vt_is_iterable(obj:VariableTracker) -> boolCheck if the object supports iteration (i.e.
class
torch._dynamo.variables.sets.SetVariableRepresents a Python set during symbolic execution.
func
torch._dynamo.variables.sets.set_copy(obj:VariableTracker) -> VariableTrackerMirrors CPython's internal `set_copy` (Objects/setobject.c).
class
torch._dynamo.variables.streams.StreamContextVariableThis represents torch.cuda.StreamContext
class
torch._dynamo.variables.streams.StreamVariableRepresents the device-agnostic torch.Stream class
class
torch._dynamo.variables.streams.SymbolicStreamStateTrack the currently entered stream if any
class
torch._dynamo.variables.tensor.SymNodeVariableRepresents a symbolic scalar, either int, float or bool.
class
torch._dynamo.variables.torch.DispatchKeySetVariablerepresents torch.DispatchKeySet
class
torch._dynamo.variables.user_defined.DefaultDictVariableRepresents collections.defaultdict instances.
class
torch._dynamo.variables.user_defined.UserDefinedObjectVariableMostly objects of defined type.
class
torch._export.ExportDynamoConfigManage Export-specific configurations of Dynamo.
class
torch._export.converter.ExplainTS2FXGraphConverterRun TS2FXGraphConverter in an explain mode.
func
torch._export.converter.ir_name_to_func_name(name:str) -> strprim::If -> convert_prim_If
func
torch._export.db.case.register_db_case(case:ExportCase) -> NoneRegisters a user provided ExportCase into example bank.
class
torch._export.error.InternalErrorRaised when an internal invariance is violated in EXIR stack.
func
torch._export.error.internal_assert(pred:bool, assert_msg:str) -> NoneThis is exir's custom assert method.
func
torch._export.non_strict_utils.key_path_to_source(kp:KeyPath, sourced_prefixes:_KeyPathTrie | None=None) -> SourceGiven a key path, return the source for the key path.
class
torch._export.serde.dynamic_shapes.DynamicShapesSpecThis stores a dynamic_shapes spec for de/serialization.
class
torch._export.serde.dynamic_shapes.RootDimThis represents a Dim object.
class
torch._export.serde.serialize.ExtensionHandlerBase class for handling extension operators.
func
torch._export.serde.serialize.serialize_tensor_meta(t:torch.Tensor) -> TensorMetaExtract a TensorMeta describing `t`.
func
torch._export.utils.is_buffer(program:'ExportedProgram', node:torch.fx.Node) -> boolChecks if the given node is a buffer within the exported program
func
torch._export.utils.node_replace_(old_node:torch.fx.Node, new_node:torch.fx.Node) -> NoneReplace all uses of old_node with new_node.
func
torch._export.utils.wrap_method(method:Callable[..., object]) -> _WrappedMethodWrap a method as a module so that it can be exported.
class
torch._functorch._aot_autograd.aot_autograd_result.CompiledBackwardCacheable entry for a backward function
class
torch._functorch._aot_autograd.aot_autograd_result.CompiledForwardCacheable entry for a forward function
class
torch._functorch._aot_autograd.aot_autograd_result.InductorOutputClass representing a single inductor output
class
torch._functorch._aot_autograd.autograd_cache.AOTAutogradCacheCaches the results of running AOTAutograd.
method
torch._functorch._aot_autograd.autograd_cache.AOTAutogradCache.clear() -> NoneClear the cache
method
torch._functorch._aot_autograd.autograd_cache.AOTAutogradCache.save(key:str, entry:GenericAOTAutogradResult[Any, Any], remote:bool) -> NoneSave a single entry into the cache.
func
torch._functorch._aot_autograd.autograd_cache.check_cacheable(gm:torch.fx.GraphModule) -> NoneChecks that the graph module only uses supported operators
func
torch._functorch._aot_autograd.autograd_cache.check_node_safe(node:Node) -> NoneChecks that the node only uses supported operators.
func
torch._functorch._aot_autograd.autograd_cache.is_safe_torch_function(target:Callable[..., Any]) -> boolAllowlisted torch functions
class
torch._functorch._aot_autograd.descriptors.BufferAOTInputThe input is a buffer, whose FQN is target
class
torch._functorch._aot_autograd.descriptors.ParamAOTInputThe input is a parameter, whose FQN is target
func
torch._functorch._aot_autograd.fx_utils.get_buffer_nodes(graph:fx.Graph) -> list[fx.Node]Get all buffer nodes from a graph as a list.
func
torch._functorch._aot_autograd.fx_utils.get_named_buffer_nodes(graph:fx.Graph) -> dict[str, fx.Node]Get buffer nodes mapped by their fully qualified names.
func
torch._functorch._aot_autograd.fx_utils.get_named_param_nodes(graph:fx.Graph) -> dict[str, fx.Node]Get parameter nodes mapped by their fully qualified names.
func
torch._functorch._aot_autograd.fx_utils.get_param_nodes(graph:fx.Graph) -> list[fx.Node]Get all parameter nodes from a graph as a list.
func
torch._functorch._aot_autograd.graph_compile.aot_stage2_autograd(aot_state:AOTState, aot_graph_capture:AOTGraphCapture, partition_fn:Callable, fw_compiler:Callable, bw_compiler:Callable) -> DispatchReturnAutograd logic.
func
torch._functorch._aot_autograd.logging_utils.get_aot_graph_name() -> strReturns the name of the graph being compiled.
class
torch._functorch._aot_autograd.schemas.AOTConfigConfiguration for AOTDispatcher
class
torch._functorch._aot_autograd.schemas.GraphSignatureProvides information about an exported module.
class
torch._functorch._aot_autograd.schemas.SubclassCreationMetaUsed for AOTDispatch.
func
torch._functorch._aot_autograd.streams.assign_backward_streams(gm:torch.fx.GraphModule) -> NoneAssigns backward streams to gradient accumulation nodes
func
torch._functorch._aot_autograd.streams.wrap_all_sync_nodes_with_control_deps(gm:torch.fx.GraphModule) -> NoneSingle-pass wrap of all sync nodes in control_deps.
func
torch._functorch._aot_autograd.utils.get_default_generator(device:torch.device) -> AnyGet the default RNG generator for a device.
func
torch._functorch._aot_autograd.utils.get_device_rng_state(device:torch.device) -> torch.TensorGet the RNG state tensor for a device.
func
torch._functorch._aot_autograd.utils.import_async_collective_tensor_type() -> type['AsyncCollectiveTensor']Import and return the ACT type.
func
torch._functorch._aot_autograd.utils.supports_graphsafe_rng(device:torch.device) -> boolCheck whether a device supports graphsafe RNG operations.
func
torch._functorch.compilers.nop(fx_g:fx.GraphModule, _:Any) -> fx.GraphModuleReturns the :attr:`fx_g` Fx graph module as it is.
func
torch._functorch.compilers.ts_compile(fx_g:fx.GraphModule, inps:Sequence[Any]) -> torch.jit.ScriptModuleCompiles the :attr:`fx_g` with Torchscript compiler.
func
torch._functorch.eager_transforms.debug_unwrap(tensor:torch.Tensor, *recurse:bool=True) -> torch.TensorUnwraps a functorch tensor (e.g.
class
torch._functorch.partitioners.OpTypesClass for keeping track of different operator categories
func
torch._functorch.partitioners.calculate_range(dtype:torch.dtype) -> tuple[float, float]Calculate the range of values for a given torch.dtype.
func
torch._functorch.partitioners.calculate_tensor_size(tensor:torch.Tensor) -> floatCalculate the size of a PyTorch tensor in megabytes (MB).
func
torch._functorch.partitioners.get_node_weight(node:fx.Node, static_lifetime_input_nodes:OrderedSet[fx.Node]) -> tuple[float, str | None]Returns (weight, cannot_save_reason).
func
torch._functorch.partitioners.visualize_min_cut_graph(nx_graph:nx.DiGraph[str, dict[str, Any]]) -> tuple[str | None, str | None]Visualize the min-cut graph to an SVG file.
class
torch._guards.InlinedCodeCacheCache for code-object-derived data used during inlining.
method
torch._guards.Source.reconstruct_pycode(codegen:PyCodegen) -> strReconstructs the source into a string of Python code.
method
torch._guards.Source.subguards_allowed() -> boolTrue if you can guard on attributes of this
class
torch._guards.TracingContextProvides the currently installed TracingContext, or None.
func
torch._guards.detect_fake_mode(inputs:Any=None) -> FakeTensorMode | NoneAttempts to "detect" what the current fake mode is.
func
torch._higher_order_ops.cond.cond(pred:bool | int | float | torch.Tensor, true_fn:Callable, false_fn:Callable, operands:tuple | list=()) -> AnyConditionally applies `true_fn` or `false_fn`.
func
torch._higher_order_ops.flat_apply.from_graphable(flat_args:tuple[Unpack[_Ts]], spec:pytree.TreeSpec) -> pytree.PyTreeThe inverse of to_graphable.
func
torch._higher_order_ops.flat_apply.is_graphable_type(typ:type[object]) -> boolReturn whether the given type is graphable.
func
torch._higher_order_ops.flat_apply.to_graphable(stuff:pytree.PyTree) -> tuple[list[object], pytree.TreeSpec]Flattens stuff into a flat list of graphable types.
class
torch._higher_order_ops.flex_gemm.FlexGemmOpSpecCanonical operand positions for a supported FlexGEMM op.
func
torch._higher_order_ops.flex_gemm.flex_gemm_fast_math_sigmoid(x:torch.Tensor) -> torch.TensorUse the tanh sigmoid identity selected by QUACK fast math.
func
torch._higher_order_ops.flex_gemm.flex_gemm_fast_math_silu(x:torch.Tensor) -> torch.TensorUse the tanh SiLU identity selected by QUACK fast math.
class
torch._higher_order_ops.invoke_subgraph.InvokeSubgraphAutogradOpSaves the subgraph, i.e.
func
torch._higher_order_ops.map.map(f:Callable[[pytree.PyTree, tuple[pytree.PyTree, ...]], pytree.PyTree], xs:pytree.PyTree | torch.Tensor, *args:TypeVarTuple)Performs a map of f with xs.
class
torch._higher_order_ops.register_hook.RegisterHookOpHOP that registers a backward hook on a tensor.
class
torch._higher_order_ops.triton_kernel_wrap.ReadWriteIndexesReturn the argument indexes read / written.
func
torch._higher_order_ops.triton_kernel_wrap.first_arg(op:Op) -> list[int]Return the first argument index after checking that it exists.
func
torch._higher_order_ops.triton_kernel_wrap.unregister_kernel_access_op(name:str) -> NoneUnregister a Triton op from kernel read/write analysis.
func
torch._higher_order_ops.utils.query_requires_grad(t:torch.Tensor) -> boolrequires_grad of ``t``, looking through a functional wrapper.
method
torch._higher_order_ops.wrap.InductorCodeSideTable.add_callable(callable_obj:InductorCompiledCallable) -> intRegister a callable and return its idx.
method
torch._higher_order_ops.wrap.InductorCodeSideTable.get_callable(idx:int) -> InductorCompiledCallableGet the callable at the given index.
method
torch._higher_order_ops.wrap.InductorCodeSideTable.reset_table() -> NoneReset the table.
class
torch._higher_order_ops.wrap.WrapActivationCheckpointThis operator is used to wrap torch.utils.checkpoint.
class
torch._inductor.analysis.device_info.DeviceInfoTheoretical numbers from data sheet.
func
torch._inductor.analysis.profile_analysis.main() -> NoneMain function for the profile analysis script.
func
torch._inductor.analyze_preserves_zero_mask.prologue_preserves_zero_mask(prologue:'SchedulerNode') -> boolDoes this prologue preserve zero masks
func
torch._inductor.aoti_load_package(path:FileLike, run_single_threaded:bool=False, device_index:int=-1) -> AOTICompiledModelLoads the model from the PT2 package.
class
torch._inductor.async_compile.CompiledTritonKernelsIn memory cache for storing compiled triton kernels.
func
torch._inductor.async_compile.get_compile_threads() -> intTemporary for internal rollout.
func
torch._inductor.async_compile.shutdown_compile_workers() -> NoneShut down all outstanding compile-worker pools.
class
torch._inductor.autotune_process.BenchmarkRequestOnly handle triton template benchmark for now.
class
torch._inductor.autotune_process.CUTLASSBenchmarkRequestA class to handle CUDA (CUTLASS) benchmark requests.
class
torch._inductor.autotune_process.ExternKernelBenchmarkRequestA class to handle extern kernel benchmark requests.
class
torch._inductor.autotune_process.PrecompileThreadPoolThread pool for running precompilation asynchronously.
class
torch._inductor.autotune_process.SubgraphBenchmarkRequestBenchmark request for subgraph choices.
func
torch._inductor.autotune_process.run_autotune_in_subprocess(benchmark_request:BenchmarkRequest) -> floatRun autotuning benchmarks in a subprocess.
func
torch._inductor.autows_utils.has_meta_ws() -> boolWhether Meta Triton autoWS is available.
class
torch._inductor.cache.AsyncCacheAsynchronous cache implementation using ThreadPoolExecutor.
method
torch._inductor.cache.AsyncCache.get_async(key:Key, executor:ThreadPoolExecutor) -> Future[Value | None]Retrieve a value from the cache asynchronously.
method
torch._inductor.cache.AsyncCache.insert_async(key:Key, value:Value, executor:ThreadPoolExecutor) -> Future[bool]Insert a value into the cache asynchronously.
class
torch._inductor.cache.CacheAbstract base class for cache implementations.
method
torch._inductor.cache.Cache.get(key:Key) -> Value | NoneRetrieve a value from the cache.
method
torch._inductor.cache.Cache.insert(key:Key, value:Value) -> boolInsert a value into the cache.
class
torch._inductor.cache.CacheErrorException raised for errors encountered during cache operations.
method
torch._inductor.cache.InMemoryCache.from_env_var(env_var:str) -> SelfCreate an in-memory cache from an environment variable.
method
torch._inductor.cache.InMemoryCache.from_file_path(fpath:Path) -> SelfCreate an in-memory cache from a file path.
method
torch._inductor.cache.InMemoryCache.get(key:Key) -> Value | NoneRetrieve a value from the cache.
method
torch._inductor.cache.InMemoryCache.insert(key:Key, value:Value) -> boolInsert a value into the cache.
class
torch._inductor.cache.InductorOnDiskCacheInductor-specific on-disk cache implementation.
method
torch._inductor.cache.InductorOnDiskCache.base_dir() -> PathGet the base directory for the Inductor cache.
class
torch._inductor.cache.OnDiskCacheOn-disk cache implementation using files and file locks.
method
torch._inductor.cache.OnDiskCache.base_dir() -> PathGet the base directory for the cache.
method
torch._inductor.cache.OnDiskCache.get(key:Key) -> Value | NoneRetrieve a value from the cache.
method
torch._inductor.cache.OnDiskCache.insert(key:Key, value:Value) -> boolInsert a value into the cache.
method
torch._inductor.cache.OnDiskCache.version_prefix() -> bytesGet the version prefix for the cache.
class
torch._inductor.choices.SortableAnything that can be used as a list.sort() key (int/tuple/etc)
class
torch._inductor.codecache.AotCodeCompilerCompile AOT Inductor generated code.
class
torch._inductor.codecache.CppCodeCacheCompiles and caches C++ libraries.
About this data
These signatures were extracted from the public source of pytorch/pytorch
using Python's ast module. Argument names, default values,
type annotations and return types are taken verbatim from the code.
Implementation bodies are never stored. See
how it works for details.