Skip to main content
torch.js has not been released yet.
torch.js logotorch.js logotorch.js
PlaygroundContact
Login
Documentation
IntroductionType SafetyTensor ExpressionsTensor IndexingEinsumEinopsAutogradTraining a ModelProfiling & MemoryPyTorch MigrationBest PracticesRuntimesPerformancePyTorch CompatibilityBenchmarksDType Coverage
CompatibilityBenchmarksDType Coverage
absacosacoshAdaptivePool1dShapeAdaptivePool2dShapeaddaddbmmAddbmmOptionsaddcdivAddcdivOptionsaddcmulAddcmulOptionsaddmmAddmmOptionsaddmvAddmvOptionsaddrAddrOptionsadjointallallcloseAllcloseOptionsAlphaBetaOptionsamaxaminaminmaxAminmaxOptionsangleanyapplyOutarangeare_deterministic_algorithms_enabledargmaxargminargsortargwhereas_stridedas_tensorasinasinhAssertNoShapeErrorAssertNotErrorAsStridedOptionsAtat_error_index_out_of_boundsatanatan2atanhatleast_1datleast_2datleast_3dAtShapeautocast_decrement_nestingautocast_increment_nestingautograd_gradient_mismatch_errorautograd_not_registered_errorAutogradConfigAutogradDeviceAutogradDTypeAutogradEntryAutogradHandleAutogradHandleImplAxesRecordBackwardFnbaddbmmBaddbmmOptionsbartlett_windowBaseKernelConfigbatch_dimensions_do_not_match_errorbernoulliBernoulliOptionsBinaryBackwardFnBinaryBroadcastResultBinaryDTypeBinaryKernelConfigCPUBinaryKernelCPUBinaryOpConfigBinaryOpNamesBinaryOpSchemaBinaryOptionsbincountBincountOptionsbitwise_andbitwise_left_shiftbitwise_notbitwise_orbitwise_right_shiftbitwise_xorblackman_windowblock_diagbmmBooleanDTypeRulebroadcast_error_incompatible_dimensionsbroadcast_shapesbroadcast_tensorsbroadcast_toBroadcastShapeBroadcastShapeRulebroadcastShapesbucketizeBucketizeOptionsBufferUsagebuildEinopsErrorbuildErrorMessagecanBroadcastTocartesian_prodcatCatOptionsCatShapeCauchyOptionscdistCdistOptionsceilceluCeluFunctionalOptionschain_matmulCheckShapeErrorCholeskyShapechunkchunk_error_dim_out_of_rangeChunkOptionsclampClampOptionsclear_autocast_cacheclearEinopsCacheclearEinsumCacheclonecolumn_stackcombinationsCombinationsOptionscompiled_with_cxx11_abicomplexconjconj_physicalcontiguousConv1dShapeConv2dShapeConv3dShapeConvTranspose2dShapecopysigncorrcoefcoscoshcount_nonzeroCountNonzeroOptionscovcoverage_reportcoverageReportCoverageReportCovOptionsCPUForwardFnCPUKernelConfigCPUKernelEntryCPUOnlyResultCPUTensorDatacreateCumExtremeResultcreateTorchCreationOpSchemaCumExtremeResultcummaxcummincumprodCumShapecumsumcumulative_trapezoidCumulativeOptionsCumulativeOptionsWithDimdeg2raddetachDeterministicOptionsDetShapeDevicedevice_error_requiresDeviceBufferDeviceCapabilitiesDeviceCheckedResultDeviceConfigDeviceContextDeviceEntryDeviceHandleDeviceInputDeviceOptionsDeviceRegistryDeviceTypediagdiag_embedDiagEmbedOptionsdiagflatDiagflatOptionsDiagFlatOptionsdiagonal_scatterDiagonalOptionsDiagonalScatterOptionsDiagOptionsDiagShapediffDiffOptionsdigammadimension_error_out_of_rangeDispatchConfigdistDistOptionsdivdotDotShapeRuleDoubleDoubleDimdropoutDropoutFunctionalOptionsdsplitdstackDTypedtype_already_registered_errordtype_components_mismatch_errordtype_not_found_errorDTypeComponentsDTypeConfigDTypeCoverageReportDTypeDisplayConfigDTypeEntryDTypeHandleDTypeHandleImplDTypeInfoDTypeRegistryDTypeRuleDTypeSerializationConfigDynamicShapeEigShapeeinops_error_ambiguous_decompositioneinops_error_anonymous_in_outputeinops_error_dimension_mismatcheinops_error_invalid_patterneinops_error_reduce_undefined_outputeinops_error_repeat_missing_sizeeinops_error_undefined_axiseinsumeinsum_error_dimension_mismatcheinsum_error_index_out_of_rangeeinsum_error_invalid_equationeinsum_error_invalid_sublist_elementeinsum_error_operand_count_mismatcheinsum_error_subscript_rank_mismatcheinsum_error_unknown_output_indexEinsumOptionsEinsumOutputShapeEllipsiseluelu_EluFunctionalOptionsembedding_bag_error_requires_2d_inputemptyempty_cacheempty_likeeqequalerferfcerfinvexpexp2expandexpand_asexpand_error_incompatibleExpandShapeexpm1ExponentialOptionseyeEyeOptionsfftFFTOptionsfindKernelWithPredicatefindSimilarPatternsflattenFlattenOptionsFlattenShapeflipflip_error_dim_out_of_rangefliplrFlipShapeflipudfloat_powerFloatDTypeRulefloorfloor_dividefmaxfminfmodformatEquationErrorformatShapefracfrexpfrombufferfullfull_likefunction_already_registered_errorFunctionConfigFunctionEntryFunctionHandlegathergather_error_dim_out_of_rangeGatherShapegcdgegeluGeometricOptionsget_autocast_cpu_dtypeget_autocast_gpu_dtypeget_autocast_ipu_dtypeget_autocast_xla_dtypeget_default_deviceget_default_dtypeget_deterministic_debug_modeget_device_configget_device_contextget_device_moduleget_dtype_infoget_file_pathget_float32_matmul_precisionget_num_interop_threadsget_num_threadsget_op_infoget_printoptionsget_real_dtypeget_rng_stategetAutogradgetDTypegetEinopsCacheSizegetEinsumCacheSizegetFunctiongetKernelgetMethodgetOpInfoGetOpKindGetOpSchemagetScalarKernelgluGluFunctionalOptionsGradContextGradFnGradientsForgtHalfHalfDimhamming_windowhann_windowhardshrinkhardsigmoidhardswishhardtanhhardtanh_HardtanhFunctionalOptionshas_autogradhas_devicehas_dtypehas_kernelhasAutogradhasDTypehasFunctionhasKernelhasMethodhasScalarKernelHasShapeErrorheavisidehistcHistcOptionshistogramHistogramOptionsHistogramResulthsplithstackhypoti0IdentityShapeifftimagindex_addindex_copyindex_fillindex_putindex_reduceindex_selectindex_select_error_dim_out_of_rangeIndexPutOptionsIndexSelectShapeIndexSpecIndicesOptionsIndicesSpecinitialize_deviceInputsForInsertDiminvalid_config_errorinverseInverseShapeirfftis_anomaly_check_nan_enabledis_anomaly_enabledis_autocast_cache_enabledis_autocast_cpu_enabledis_autocast_ipu_enabledis_autocast_xla_enabledis_complexis_complex_dtypeis_cpu_only_modeis_deterministic_algorithms_warn_only_enabledis_floating_pointis_floating_point_dtypeis_inference_mode_enabledis_nonzerois_tensoris_warn_always_enabledis_webgpu_availableIs2DIsAtLeast1DIsBinaryOpIsBinaryOpNameiscloseIscloseOptionsisfiniteisinisinfisnanisneginfisposinfisrealIsReductionOpIsReductionOpNameIsRegistryErrorIsShapeErroristftISTFTOptionsIsUnaryOpIsUnaryOpNameitem_error_not_scalarItemResultkaiser_windowKaiserWindowOptionskernel_not_registered_errorkernel_signature_mismatch_errorKernelConfigKernelConfigWebGPUKernelEntryKernelHandleKernelInfoKernelPredicateKernelRegistryKernelWebGPUkronkthvalueKthvalueOptionslcmldexpleleaky_reluleaky_relu_LeakyReluFunctionalOptionslerplevenshteinDistancelgammalinalg_error_not_square_matrixlinalg_error_requires_2dlinalg_error_requires_at_least_2dlinearlinspacelist_custom_deviceslist_custom_dtypeslist_deviceslist_dtypeslist_functionslist_kernelslist_methodslist_opslistCustomDTypeslistDTypeslistFunctionslistKernelsListKernelsOptionslistMethodslistOpsListOpsOptionsloglog_softmaxlog10log1plog2logaddexplogaddexp2logcumsumexplogical_andlogical_notlogical_orlogical_xorLogitOptionsLogNormalOptionsLogOptionslogsigmoidlogspacelogsumexpLogsumexpOptionsltLUShapeLuSolveOptionsmasked_fillmasked_selectmasked_select_asyncMaskSpecmatmulmatmul_error_inner_dimensions_do_not_matchMatmul2DShapeMatmulShapeMatmulShapeRuleMatrixTransposeShapemaxmaximummeanmedianmemory_statsmemory_summarymeshgridmethod_already_registered_errormethod_dtype_not_supported_errorMethodConfigMethodEntryMethodHandleminminimummishmmMMShapeRulemodemovedimmsortmulmultinomialmultinomial_asyncMultinomialAsyncOptionsMultinomialOptionsMultiplyBymvMVShapeRulenan_to_numnanmeannanmediannanquantileNanReductionOptionsnansumNanToNumOptionsnarrownarrow_copynarrow_error_length_exceeds_boundsnarrow_error_start_out_of_boundsNarrowShapeneneedsBroadcastnegNegativeDimnextafternonzeroNonzeroOptionsnormnormalNormalOptionsNormOptionsnumelonesones_likeop_kind_mismatch_errorop_not_found_errorOpCoverageEntryOpInfoOpKindOpNameOpSchemaOpSchemasouterOuterShapepackPackShapepermutepermute_error_dimension_count_mismatchPermuteShapepoissonpolarPool1dShapePool2dShapePool3dShapepositivepowpreluPrintOptionsprodprofiler_allow_cudagraph_cupti_lazy_reinit_cuda12promote_typesPromoteDTypeRulePutOptionsquantileQuantileOptionsrad2degrandrand_likerandintrandint_likeRandintLikeOptionsRandintOptionsrandnrandn_likeRandomLikeOptionsRandomOptionsrandpermRangeSpecRankravelrealrearrangeRearrangeOptionsRearrangeShapereciprocalreduceReduceOperationReduceOptionsReduceShapeReductionKernelConfigCPUReductionKernelCPUReductionOpNamesReductionOpSchemaReductionOptionsReductionShapeRuleregister_backwardregister_deviceregister_dtyperegister_forwardregister_functionregister_methodregister_scalar_forwardregisterAutogradRegisterBackwardOptionsregisterBinaryOpregisterDTypeRegisterDTypeOptionsRegisteredDTyperegisterFunctionRegisterFunctionOptionsregisterKernelRegisterKernelOptionsregisterMethodRegisterMethodOptionsregisterScalarKernelregisterUnaryOpregistration_failed_errorrelurelu_relu6ReluFunctionalOptionsremainderRemoveDimrepeatrepeat_interleaveRepeatInterleaveOptionsRepeatOptionsRepeatShapeReplaceDimrequireWebGPUreset_peak_memory_statsreshapeReshapeShaperesult_typerfftrollRollOptionsrot90Rot90Optionsroundrrelurrelu_RreluFunctionalOptionsrsqrtSafeExpandShapeSameDTypeRuleSameShapeRuleSaveForBackwardScalarCPUForwardFnScalarCPUKernelConfigScalarKernelEntryScalarKernelHandleScalarWebGPUKernelConfigScaleDimscatterscatter_addscatter_add_scatter_error_dim_out_of_rangescatter_reducescatter_reduce_ScatterReduceOptionsScatterShapesearchsortedSearchSortedOptionsselectselect_error_index_out_of_boundsselect_scatterSelectShapeseluset_default_deviceset_default_tensor_typeset_deterministic_debug_modeset_float32_matmul_precisionset_printoptionsset_warn_alwaysSetupContextFnShapeShapeCheckedResultShapedTensorShapeErrorMessageShapeOpSchemaShapeRulesigmoidsignsignbitsilusinsincsinhSizeOptionsslice_error_out_of_boundsslice_scatterSliceOptionsSliceScatterOptionsSliceShapeSliceSpecsoftmaxsoftmax_error_dim_out_of_rangeSoftmaxShapesoftminSoftminFunctionalOptionssoftplusSoftplusFunctionalOptionssoftshrinksoftsignsortSortOptionssplitsplit_error_dim_out_of_rangeSplitOptionssqrtsquaresqueezeSqueezeOptionsSqueezeShapestackStackOptionsStackShapestdstd_meanStdVarMeanOptionsStdVarOptionsstftSTFTOptionsStrideOptionssubSublistSublistElementSubscriptIndexsumSVDShapeswapaxessym_floatsym_intsym_notttaketake_along_dimTakeAlongDimOptionstantanhtanhshrinktensortensor_splitTensorCreatorTensorDatatensordotTensordotOptionsTensorLikeTensorMetaTensorOptionsTensorStoragethresholdthreshold_tileTileShapeToOptionstopkTopkOptionsTorchtraceTraceShapetransposetranspose_dims_error_out_of_rangetranspose_error_requires_2d_tensorTransposeDimsShapeTransposeDimsShapeCheckedTransposeShapetrapezoidTrapezoidOptionsTriangularOptionstriltril_indicesTriOptionsTripletriutriu_indicestrue_dividetruncTupleOfLengthTypedArrayTypedArrayForTypedStorageTypeOptionsUnaryBackwardFnUnaryDTypeUnaryKernelConfigCPUUnaryKernelCPUUnaryOpConfigUnaryOpFnUnaryOpNamesUnaryOpParamsUnaryOpSchemaUnaryOptionsunbindunbind_error_dim_out_of_rangeUnbindOptionsunflattenUniformOptionsuniqueunique_consecutiveUniqueConsecutiveOptionsUniqueOptionsunpackUnpackShapeunravel_indexunregister_deviceunsqueezeUnsqueezeOptionsUnsqueezeShapeuse_deterministic_algorithmsValidateBatchedSquareMatrixValidateChunkDimValidatedEinsumShapevalidateDeviceValidateDeviceValidatedRearrangeShapeValidatedReduceShapeValidatedRepeatShapevalidateDTypeValidateEinsumValidateOperandCountValidateRanksValidateScalarValidateSplitDimValidateSquareMatrixValidateUnbindDimValueOptionsvar_var_meanvdotviewview_as_complexview_as_realvmapvsplitvstackWebGPUKernelConfigWebGPUOnlyResultWebGPUTensorDatawhereWindowOptionsxlogyzeroszeros_like
torch.js· 2026
LegalTerms of UsePrivacy Policy
/
/
  1. docs
  2. torch.js
  3. torch

torch

Modules

  • Tensor
  • autograd
  • distributions
  • fft
  • linalg
  • memory
  • nn
  • optim
  • profiler
  • serialization
  • special
  • tx

Functions

  • is_tensor - Checks whether the given object is a Tensor instance.
  • is_floating_point - Checks whether a tensor has a floating-point data type.
  • is_complex - Check if tensor has a complex numeric dtype.
  • result_type - Returns the dtype that would result from an arithmetic operation
  • is_autocast_cpu_enabled - Checks if automatic mixed precision is enabled for CPU operations.
  • is_autocast_ipu_enabled - Checks if automatic mixed precision is enabled for IPU (Intel Processing Unit) operations.
  • is_autocast_xla_enabled - Checks if automatic mixed precision is enabled for XLA (Tensor Compiler) operations.
  • is_autocast_cache_enabled - Checks if the autocast cache is enabled.
  • get_autocast_cpu_dtype - Returns the data type used by autocast for CPU operations.
  • get_autocast_gpu_dtype - Returns the data type used by autocast for GPU (CUDA) operations.
  • get_autocast_ipu_dtype - Returns the data type used by autocast for IPU operations.
  • get_autocast_xla_dtype - Returns the data type used by autocast for XLA operations.
  • clear_autocast_cache - Clears the autocast dtype and shape cache.
  • autocast_increment_nesting - Increments the autocast nesting level.
  • autocast_decrement_nesting - Decrements the autocast nesting level.
  • is_anomaly_enabled - Checks if anomaly detection is enabled for gradient computation.
  • is_anomaly_check_nan_enabled - Checks if anomaly detection specifically checks for NaN values in gradients.
  • is_inference_mode_enabled - Checks if inference mode is enabled.
  • get_num_threads - Returns the number of threads used for intra-op parallelism.
  • get_num_interop_threads - Returns the number of threads used for inter-op parallelism.
  • get_default_dtype - Returns the default data type used for newly created tensors.
  • get_device_module - Returns the device module for the specified device type.
  • get_rng_state - Returns the current random number generator state.
  • profiler_allow_cudagraph_cupti_lazy_reinit_cuda12 - Allows CUDA graph lazy reinitialization for NVIDIA CUDA 12.
  • compiled_with_cxx11_abi - Checks if torch.js was compiled with C++11 ABI compatibility.
  • get_file_path - Returns the file path for a module or resource.
  • use_deterministic_algorithms - Enables or disables deterministic algorithms for reproducibility.
  • sym_float - Creates a symbolic float from a numeric value.
  • sym_int - Creates a symbolic integer from a numeric value.
  • sym_not - Creates the logical negation of a symbolic boolean value.
  • createTorch - Creates the torch object with specific serialization implementations.
  • get_default_device - Returns the current default device for tensor operations.
  • set_default_device - Sets the default device for tensor creation operations.
  • is_webgpu_available - Checks if WebGPU acceleration is available in the current environment.
  • requireWebGPU - Assert that WebGPU is available for GPU-only operations.
  • is_cpu_only_mode - Checks if the current environment is operating in CPU-only mode.
  • validateDType - Runtime validation that a value is a valid DType.
  • promote_types - Returns the lowest common dtype that can safely hold values from both input dtypes.
  • is_floating_point_dtype - Checks if the given dtype is a floating-point type.
  • is_complex_dtype - Checks if the given dtype is a complex number type.
  • get_real_dtype - Get the underlying real dtype for a complex dtype.
  • list_ops - List all registered operations.
  • get_op_info - Get detailed information about an operation.
  • list_dtypes - List all registered dtypes (built-in and custom).
  • list_custom_dtypes - List only custom-registered dtypes (not built-in).
  • has_dtype - Check if a dtype is registered (built-in or custom).
  • get_dtype_info - Get detailed information about a dtype.
  • list_kernels - List all registered kernels.
  • has_kernel - Check if a kernel is registered for (op, dtype, device).
  • has_autograd - Check if autograd is registered for an operation.
  • list_functions - List all registered custom functions.
  • list_methods - List all registered custom methods.
  • coverage_report - Generate a coverage report for registered operations.
  • register_backward - Register autograd with full configuration object.
  • register_device - Register a custom device backend.
  • initialize_device - Initialize a registered device.
  • get_device_context - Get a registered device's context.
  • get_device_config - Get a registered device's configuration.
  • has_device - Check if a device is registered.
  • list_devices - List all registered devices (both built-in and custom).
  • list_custom_devices - List only custom registered devices.
  • unregister_device - Unregister a custom device.
  • register_dtype - Register a custom dtype with full configuration object.
  • register_forward - Register a kernel with full configuration object.
  • register_function - Register a custom function with full configuration object.
  • register_method - Register a custom Tensor method with full configuration object.
  • register_scalar_forward - Register a scalar operation kernel (tensor-scalar operations).
  • relu - Applies the ReLU (Rectified Linear Unit) function element-wise.
  • gelu - Applies the GELU (Gaussian Error Linear Unit) function element-wise.
  • silu - Applies the SiLU (Sigmoid Linear Unit) / Swish function element-wise.
  • leaky_relu - Applies the Leaky ReLU function element-wise.
  • elu - Applies the ELU (Exponential Linear Unit) function element-wise.
  • selu - Applies the SELU (Scaled Exponential Linear Unit) function element-wise.
  • softplus - Applies the Softplus function element-wise.
  • softsign - Applies the Softsign function element-wise.
  • hardsigmoid - Applies the Hardsigmoid function element-wise.
  • hardswish - Applies the Hardswish function element-wise.
  • matmul - Matrix multiplication of two tensors (universal @ operator).
  • mm - Performs matrix multiplication between two 2D tensors.
  • bmm - Perform batched matrix-matrix multiplication.
  • chain_matmul - Efficiently multiplies a sequence of matrices, optimizing for minimum computation cost.
  • mv - Perform matrix-vector multiplication.
  • dot - Computes the dot product of two 1D vectors.
  • vdot - Compute the vector dot product with conjugation.
  • outer - Computes the outer product of two 1D vectors.
  • addmm - Performs fused matrix multiplication and addition: betainput + alpha(mat1 @ mat2).
  • addmv - Performs fused matrix-vector multiplication and addition: betainput + alpha(mat @ vec).
  • addr - Performs fused outer product and addition: betainput + alpha(vec1 ⊗ vec2).
  • baddbmm - Performs fused batched matrix multiplication and addition: betainput + alpha(batch1 @ batch2).
  • addbmm - Performs fused batched matrix multiplication, reduces batch dimension with sum, and adds: beta*input
  • trapezoid - Integrates values along a dimension using the trapezoidal rule.
  • cumulative_trapezoid - Computes the cumulative integral along a dimension using the trapezoidal rule.
  • kron - Computes the Kronecker product of two tensors.
  • tensordot - Computes generalized tensor contraction over specified dimensions.
  • inverse - Computes the matrix inverse: A^(-1) such that A @ A^(-1) = I.
  • cdist - Computes pairwise distances between two sets of vectors using various distance metrics.
  • eq - Element-wise comparison of two tensors with a specified tolerance.
  • ne - Element-wise inequality comparison: returns true where input != other.
  • lt - Element-wise less-than comparison: returns true where input < other.
  • le - Element-wise less-than-or-equal comparison: returns true where input <= other.
  • gt - Element-wise greater-than comparison: returns true where input > other.
  • ge - Element-wise greater-than-or-equal comparison: returns true where input >= other.
  • isnan - Returns a boolean tensor indicating which elements are NaN (Not a Number).
  • isinf - Returns a boolean tensor indicating which elements are +/- infinity.
  • isfinite - Returns a boolean tensor indicating which elements are finite (valid numbers).
  • isposinf - Returns a boolean tensor indicating which elements are positive infinity (+∞).
  • isneginf - Returns a boolean tensor indicating which elements are negative infinity (-∞).
  • isreal - Tests whether each element is a real-valued number (not complex).
  • maximum - Computes element-wise maximum of two tensors.
  • minimum - Computes element-wise minimum of two tensors.
  • fmax - Computes element-wise maximum, ignoring NaN values.
  • fmin - Computes element-wise minimum, ignoring NaN values.
  • equal - Returns true if two tensors have the same size and elements, false otherwise.
  • isclose - Element-wise tolerance-based comparison: returns true where input and other are close.
  • allclose - Test if all elements are close (within tolerance): returns single boolean result.
  • logical_not - Computes the element-wise logical NOT (negation).
  • logical_and - Computes the element-wise logical AND.
  • logical_or - Computes the element-wise logical OR.
  • logical_xor - Computes the element-wise logical XOR (exclusive OR).
  • bitwise_and - Element-wise bitwise AND: sets bit to 1 only where both operands have 1.
  • bitwise_or - Element-wise bitwise OR: sets bit to 1 if either operand has 1.
  • bitwise_xor - Element-wise bitwise XOR (exclusive OR): sets bit to 1 where operands differ.
  • bitwise_not - Element-wise bitwise NOT (complement): inverts all bits of integers.
  • bitwise_left_shift - Element-wise left bit shift: shifts bits left, filling with zeros.
  • bitwise_right_shift - Element-wise right bit shift: shifts bits right, filling with zeros (unsigned) or sign (signed).
  • sort - Sorts the elements of the input tensor along a given dimension in ascending order by value.
  • argsort - Returns the indices that would sort a tensor along a given dimension.
  • msort - Sorts the elements of the input tensor along its first dimension.
  • topk - Returns the k largest elements of the given input tensor along a given dimension.
  • kthvalue - Returns the k-th smallest element (by value) and its index along a dimension.
  • isin - Tests if each element of input is in test_elements, returning a boolean tensor.
  • view_as_complex - Interpret a real tensor as a complex tensor.
  • view_as_real - Convert a complex tensor back to its real representation.
  • polar - Reconstruct a complex tensor from its magnitude and phase angle (polar form).
  • complex - Create a complex tensor from separate real and imaginary tensors.
  • are_deterministic_algorithms_enabled - Check if deterministic algorithm mode is currently enabled.
  • is_deterministic_algorithms_warn_only_enabled - Check if warn-only mode is enabled for non-deterministic operations.
  • set_deterministic_debug_mode - Set the debug verbosity level for deterministic algorithm violations.
  • get_deterministic_debug_mode - Get the current debug verbosity level for deterministic algorithm violations.
  • set_warn_always - Enable or disable "always warn" mode for all warnings.
  • is_warn_always_enabled - Check if "always warn" mode is currently enabled.
  • set_float32_matmul_precision - Set the precision level for float32 matrix multiplications.
  • get_float32_matmul_precision - Get the current float32 matrix multiplication precision level.
  • set_printoptions - Configures how tensors are displayed when printed or logged.
  • get_printoptions - Retrieves the current tensor print options.
  • is_nonzero - Checks if a single-element tensor contains a non-zero value.
  • set_default_tensor_type - Sets the default tensor type (deprecated - use dtype and device options instead).
  • tensor - Create a tensor from array data.
  • zeros - Create a tensor filled with zeros.
  • ones - Create a tensor filled with ones.
  • full - Create a tensor filled with a specific constant value.
  • zeros_like - Create a zero-filled tensor with the same shape as another tensor.
  • ones_like - Create a one-filled tensor with the same shape as another tensor.
  • full_like - Create a constant-filled tensor with the same shape as another tensor.
  • empty - Create a tensor with uninitialized memory.
  • empty_like - Create an uninitialized tensor with the same shape as another tensor.
  • rand - Create a tensor with random values from uniform distribution [0, 1).
  • randn - Create a tensor with random values from standard normal distribution.
  • randint - Create a tensor filled with random integers in [low, high).
  • randint_like - Create a tensor with same shape as input filled with random integers.
  • rand_like - Create a tensor with same shape as input filled with uniform random values.
  • randn_like - Create a tensor with same shape as input filled with standard normal values.
  • bernoulli - Draws independent binary random numbers from a Bernoulli distribution.
  • randperm - Returns a random permutation of integers from 0 to n - 1.
  • normal - Returns a tensor of random numbers from normal distribution.
  • multinomial - Draws samples from a multinomial distribution (GPU accelerated).
  • multinomial_async - Async version of multinomial sampling that supports sampling without replacement on GPU.
  • poisson - Draws samples from a Poisson distribution with specified rate parameters.
  • eye - Creates an identity matrix (or rectangular variant).
  • arange - Create a tensor with values in a range.
  • linspace - Create a tensor with linearly spaced values.
  • logspace - Create a tensor with logarithmically spaced values.
  • tril - Returns the lower triangular part of a 2D matrix (or batch of matrices).
  • triu - Returns the upper triangular part of a 2D matrix.
  • cat - Concatenates tensors along an existing dimension.
  • stack - Concatenates a sequence of tensors along a new dimension.
  • vstack - Stacks tensors vertically (row wise).
  • hstack - Stacks tensors horizontally (column wise).
  • dstack - Stacks tensors along the depth dimension (third axis).
  • column_stack - Stacks 1-D arrays as columns into a 2-D array.
  • as_tensor - Convert data to a tensor.
  • frombuffer - Create a tensor from a buffer.
  • meshgrid - Creates coordinate grids from 1-D tensors.
  • tril_indices - Returns the row and column indices of the lower triangular part of a matrix.
  • triu_indices - Returns the row and column indices of the upper triangular part of a matrix.
  • combinations - Returns all r-length combinations of elements from the input tensor.
  • cartesian_prod - Returns the Cartesian product of input tensors.
  • clearEinopsCache - Clear the pattern cache (exported for testing)
  • getEinopsCacheSize - Get pattern cache size (exported for testing)
  • rearrange - Rearranges tensor dimensions using einops-style pattern notation.
  • reduce - Reduce tensor dimensions with pattern syntax.
  • repeat - Repeat tensor elements with pattern syntax.
  • pack - Pack multiple tensors along a new dimension.
  • unpack - Unpack a tensor into multiple tensors.
  • clearEinsumCache - Clear the equation cache (exported for testing)
  • getEinsumCacheSize - Get equation cache size (exported for testing)
  • einsum - Sums the product of the elements of the input operands along dimensions
  • levenshteinDistance - Shared error utilities for improved error messages.
  • findSimilarPatterns - Find similar einsum patterns to the given equation.
  • formatShape - Format a shape array for display.
  • formatEquationError - Format an einsum equation with visual markers for errors.
  • buildErrorMessage - Build a formatted multi-line error message.
  • buildEinopsError - Build an einops-style error message.
  • index_select - Selects elements from the input tensor along a dimension using indices.
  • select - Selects a single element along a dimension by index, removing that dimension.
  • where - Returns a tensor with elements chosen from input or other depending on condition.
  • nonzero - Returns indices of all non-zero elements in a tensor.
  • argwhere - Returns indices of all non-zero elements in a tensor.
  • gather - Gathers values from input along a dimension using indices.
  • take_along_dim - Gathers values using indices, with automatic broadcasting.
  • scatter - Scatters values into a tensor at specified indices along a dimension.
  • scatter_add - Scatters values into a tensor by adding at specified indices.
  • scatter_reduce - Scatters values with custom reduction operation at specified indices.
  • scatter_reduce_ - In-place version of scatter_reduce: applies reduction at indices in-place.
  • scatter_add_ - In-place version of scatter_add: adds at specified indices in-place.
  • index_add - Adds source elements to input at positions specified by 1D indices.
  • index_reduce - Applies custom reduction operation at 1D index positions.
  • index_put - Places values into a tensor at index positions (general indexing operation).
  • diagonal_scatter - Scatters values along a diagonal in the tensor.
  • select_scatter - Scatters a tensor at a single index position along a dimension.
  • slice_scatter - Scatters values at a slice range along a dimension.
  • take - Returns a new tensor with elements from input selected by the flat indices.
  • index_copy - In-place version of scatter_reduce: applies reduction at indices in-place.
  • index_fill - Fills positions specified by 1D indices with a scalar value.
  • masked_select - Returns a 1D tensor containing elements from input where mask is True.
  • masked_select_async - Async version of masked_select that returns a tensor with exact shape.
  • flatten - Flattens a contiguous range of dimensions into a single dimension.
  • squeeze - Removes dimensions of size 1 from the tensor.
  • unsqueeze - Adds a dimension of size 1 at the specified position.
  • broadcast_shapes - Computes the broadcast shape of multiple shapes.
  • broadcast_tensors - Broadcasts tensors to a common shape.
  • transpose - Swaps two dimensions of a tensor and returns a new tensor.
  • swapaxes - Swaps two dimensions of the input tensor.
  • adjoint - Returns a view of the tensor with the last two dimensions transposed.
  • conj - Returns the complex conjugate of the input tensor.
  • split - Splits a tensor into chunks of specified size along a dimension.
  • chunk - Splits a tensor into a specified number of chunks along a dimension.
  • narrow - Narrows a tensor along a dimension, extracting a contiguous slice.
  • tensor_split - Splits a tensor into multiple sub-tensors along a dimension.
  • hsplit - Splits input tensor into multiple tensors horizontally (column-wise).
  • vsplit - Splits input tensor into multiple tensors vertically (row-wise).
  • dsplit - Splits input tensor into multiple tensors depthwise (along the third axis).
  • unbind - Removes a dimension and returns individual tensors along that dimension.
  • unravel_index - Converts flat linear indices into multi-dimensional coordinate tensors.
  • unflatten - Expands a dimension of the input tensor over multiple dimensions.
  • roll - Rolls tensor elements along one or more dimensions.
  • rot90 - Rotates tensor 90 degrees in a 2D plane.
  • diff - Computes n-th order finite differences along a dimension.
  • repeat_interleave - Repeats tensor elements a specified number of times along a dimension.
  • clone - Creates a deep copy of the tensor.
  • contiguous - Ensures tensor is contiguous in memory.
  • detach - Detaches tensor from the autograd computational graph.
  • expand - Expands singleton dimensions to match a target shape.
  • view - Reshapes tensor to a different shape without changing data order.
  • expand_as - Expands tensor to match shape of another tensor.
  • numel - Returns the total number of elements in the tensor.
  • as_strided - Creates a view of the input tensor with the given size and stride.
  • atleast_1d - Returns a tensor with at least 1 dimension.
  • atleast_2d - Returns a tensor with at least 2 dimensions.
  • atleast_3d - Returns a tensor with at least 3 dimensions.
  • reshape - Returns a tensor with the same data and number of elements as input, but with the specified shape.
  • broadcast_to - Broadcasts input to a new shape.
  • t - Expects input to be a matrix (2-D tensor) and transposes it.
  • permute - Returns a view of the input tensor with its dimensions rearranged.
  • movedim - Moves one or more dimensions of the input tensor to new positions.
  • flip - Reverses the order of elements in a tensor along the specified dimensions.
  • fliplr - Flips the tensor along dimension 1 (horizontal flip for 2D images).
  • flipud - Flips the tensor along dimension 0 (vertical flip for 2D images).
  • narrow_copy - Returns a copy of a narrowed version of the input tensor along a dimension.
  • tile - Constructs a tensor by repeating the input tensor along specified dimensions.
  • ravel - Returns a contiguous flattened 1D tensor.
  • applyOut - Helper to copy result into out tensor if provided.
  • logcumsumexp - Returns the logarithm of the cumulative summation of the exponentiation of elements.
  • diag - Extracts the diagonal from a 2D tensor or constructs a diagonal matrix from a 1D tensor.
  • block_diag - Create a block diagonal matrix from provided tensors.
  • diag_embed - Creates a tensor whose diagonals of certain 2D planes are filled by input.
  • diagflat - Creates a 2D tensor with the flattened input on the diagonal.
  • searchsorted - Find the indices into a sorted sequence such that values would be inserted to maintain order.
  • bucketize - Returns the indices of the buckets to which each value in the input belongs.
  • bincount - Count the frequency of each value in an array of non-negative integers.
  • histc - Computes the histogram of a tensor using fixed-width bins.
  • histogram - Computes the histogram of a tensor with bin edges.
  • sum - Returns the sum of all elements in the input tensor.
  • mean - Returns the mean (average) of all elements in the input tensor.
  • prod - Returns the product of all elements in the input tensor.
  • std - Returns the standard deviation of all elements in the input tensor.
  • var_ - Returns the variance of all elements in the input tensor.
  • max - Returns the maximum value(s) and their indices along a dimension.
  • min - Returns the minimum value of all elements in the input tensor.
  • argmax - Returns the indices of the maximum value along a tensor dimension.
  • argmin - Returns the indices of the minimum value along a tensor dimension.
  • amax - Returns the maximum value along a dimension in the input tensor.
  • amin - Returns the minimum value along a dimension in the input tensor.
  • all - Tests if all elements in the input tensor evaluate to True.
  • any - Tests if any element in the input tensor evaluates to True.
  • logsumexp - Returns the log of summed exponentials along a dimension in a numerically stable way.
  • dist - Returns the p-norm distance between two tensors: norm(input - other, p).
  • aminmax - Returns both the minimum and maximum values of the input tensor.
  • nansum - Returns the sum of all elements, treating NaN values as zero.
  • nanmean - Computes the mean of all non-NaN elements.
  • std_mean - Computes both the standard deviation and mean along a dimension.
  • var_mean - Computes both the variance and mean along a dimension.
  • count_nonzero - Counts the number of non-zero values in a tensor.
  • norm - Computes the norm (vector length/magnitude) of a tensor.
  • median - Returns the median value(s) of the input tensor.
  • nanmedian - Returns the median of values, ignoring NaN values.
  • mode - Returns the mode (most frequently occurring value) along a dimension.
  • quantile - Computes the q-th quantiles of each row of the input tensor.
  • nanquantile - Computes quantiles, ignoring NaN values.
  • unique - Returns the unique elements of the input tensor.
  • unique_consecutive - Returns the unique consecutive elements of the input tensor.
  • cov - Estimates the covariance matrix of variables given observations.
  • corrcoef - Computes the Pearson correlation coefficient matrix between variables.
  • trace - Returns the trace (sum of diagonal elements) of a 2D matrix.
  • abs - Computes the absolute value of each element in the input tensor.
  • acos - Computes the inverse cosine (arc cosine) of each element in the input tensor.
  • acosh - Computes the inverse hyperbolic cosine of each element in the input tensor.
  • add - Adds a tensor or scalar to the input tensor element-wise.
  • addcdiv - Performs element-wise division then adds to input: result = input + value * (tensor1 / tensor2).
  • addcmul - Performs element-wise multiplication then adds to input: `result = input + value * (tensor1 * tensor
  • angle - Returns the angle (argument) of complex tensor elements in the complex plane.
  • asin - Computes the inverse sine (arc sine) of each element in the input tensor.
  • asinh - Computes the inverse hyperbolic sine of each element in the input tensor.
  • atan - Computes the inverse tangent (arc tangent) of each element in the input tensor.
  • atan2 - Computes element-wise arctangent of input/other with quadrant awareness.
  • atanh - Computes the inverse hyperbolic tangent of each element in the input tensor.
  • ceil - Computes the ceiling of each element in the input tensor.
  • clamp - Clamps each element to be within the specified range [min, max].
  • conj_physical - Returns the element-wise complex conjugate of the input tensor.
  • copysign - Returns a tensor with the magnitude of input and the sign of other element-wise.
  • cos - Computes the cosine of each element in the input tensor.
  • cosh - Computes the hyperbolic cosine of each element in the input tensor.
  • createCumExtremeResult - Create a namedtuple-like result for cummax/cummin - exported for Tensor methods
  • cummax - Returns the cumulative maximum along a dimension.
  • cummin - Returns the cumulative minimum along a dimension.
  • cumprod - Returns the cumulative product along a dimension.
  • cumsum - Returns the cumulative sum along a dimension.
  • deg2rad - Converts angles from degrees to radians element-wise.
  • digamma - Computes the logarithmic derivative of the gamma function (psi function).
  • div - Divides the input tensor by another tensor or scalar element-wise.
  • erf - Computes the error function of each element in the input tensor.
  • erfc - Computes the complementary error function of each element in the input tensor.
  • erfinv - Computes the inverse error function of each element in the input tensor.
  • exp - Computes the exponential of each element in the input tensor.
  • exp2 - Computes 2^x for each element in the input tensor.
  • expm1 - Computes exp(x) - 1 element-wise. More accurate than exp(x) - 1 for small x.
  • float_power - Raises input to the power of exponent using double precision arithmetic.
  • floor - Computes the floor of each element in the input tensor.
  • floor_divide - Computes element-wise floor division (integer division rounded toward negative infinity).
  • fmod - Computes C-style modulo element-wise (result has same sign as dividend).
  • frac - Computes the fractional part of each element in the input tensor.
  • frexp - Decomposes input into mantissa and exponent tensors such that input = mantissa * 2^exponent.
  • gcd - Computes the element-wise greatest common divisor (GCD) of two tensors.
  • heaviside - Computes the Heaviside step function element-wise.
  • registerBinaryOp - Register a binary operation with minimal boilerplate.
  • registerUnaryOp - Register a unary operation with minimal boilerplate.
  • hypot - Computes the hypotenuse (Euclidean distance) element-wise: sqrt(x^2 + y^2).
  • i0 - Computes the zeroth order modified Bessel function of the first kind.
  • imag - Extracts the imaginary component from a tensor of complex numbers.
  • lcm - Computes the element-wise least common multiple (LCM) of two tensors.
  • ldexp - Computes input * 2^other element-wise.
  • lerp - Linear interpolation between start and end tensors.
  • lgamma - Computes the natural logarithm of the absolute value of the gamma function.
  • log - Computes the natural logarithm of each element in the input tensor.
  • log10 - Computes the base-10 logarithm of each element in the input tensor.
  • log1p - Computes log(1 + x) element-wise. More accurate than log(1 + x) for small x.
  • log2 - Computes the base-2 logarithm of each element in the input tensor.
  • logaddexp - Computes log(exp(x) + exp(y)) element-wise in a numerically stable way.
  • logaddexp2 - Computes log2(2^x + 2^y) element-wise in a numerically stable way.
  • masked_fill - Fills elements of input tensor with value where mask is True.
  • mul - Multiplies two tensors or a tensor and scalar element-wise.
  • nan_to_num - Replaces NaN, positive infinity, and negative infinity with specified values.
  • neg - Computes the element-wise negation of the input tensor.
  • nextafter - Returns the next representable floating-point value after input towards other.
  • celu - Implementation of CELU activation.
  • dropout - Implementation of dropout.
  • elu_ - In-place ELU activation function.
  • glu - Implementation of GLU activation.
  • hardshrink - Implementation of hardshrink activation.
  • hardtanh_ - In-place version of hardtanh.
  • hardtanh - HardTanh activation function: clamps values to bounded range.
  • leaky_relu_ - In-place Leaky ReLU activation function.
  • linear - Implementation of linear transformation.
  • log_softmax - Implementation of log_softmax.
  • logsigmoid - Implementation of LogSigmoid activation.
  • mish - Implementation of Mish activation.
  • prelu - Implementation of PReLU activation.
  • relu_ - In-place ReLU activation function.
  • relu6 - Implementation of ReLU6 activation.
  • rrelu - Implementation of RReLU activation.
  • rrelu_ - In-place version of rrelu.
  • sigmoid - Sigmoid activation function.
  • softmax - Implementation of softmax.
  • softmin - Implementation of softmin activation.
  • softshrink - Implementation of softshrink activation.
  • tanh - Tanh activation function.
  • tanhshrink - Implementation of tanhshrink activation.
  • threshold - Implementation of threshold activation.
  • threshold_ - In-place threshold activation.
  • positive - Returns the input tensor unchanged. This is the unary + operator.
  • pow - Raises the input tensor to the power of the exponent element-wise.
  • rad2deg - Converts angles from radians to degrees element-wise.
  • real - Extracts the real component from a tensor of complex numbers.
  • reciprocal - Computes the element-wise reciprocal of the input tensor.
  • remainder - Computes Python-style remainder element-wise (result has same sign as divisor).
  • round - Rounds each element in the input tensor to the nearest integer.
  • rsqrt - Computes the reciprocal of the square root of each element in the input tensor.
  • sign - Returns the sign of each element: -1 for negative, 0 for zero, 1 for positive.
  • signbit - Tests if each element has its sign bit set (is negative or -0).
  • sin - Computes the sine of each element in the input tensor.
  • sinc - Computes the normalized sinc function of each element in the input tensor.
  • sinh - Computes the hyperbolic sine of each element in the input tensor.
  • sqrt - Computes the square root of each element in the input tensor.
  • square - Implementation of square activation.
  • sub - Subtracts a tensor or scalar from the input tensor element-wise.
  • tan - Computes the tangent of each element in the input tensor.
  • true_divide - Divides input by other, always producing floating-point output.
  • trunc - Truncates each element towards zero (removing fractional part).
  • xlogy - Computes x * log(y) element-wise, returning 0 when x is 0.
  • hann_window - Hann (Hanning) window: symmetric window with zero endpoints for spectral analysis.
  • hamming_window - Hamming window: cosine window with optimized coefficients for low side lobes.
  • blackman_window - Blackman window: excellent side lobe suppression at cost of wider main lobe.
  • bartlett_window - Bartlett window: simple triangular window with moderate performance.
  • kaiser_window - Kaiser window: tunable window with parametric control over frequency/sidelobe tradeoff.
  • fft - Computes the 1D discrete Fourier Transform (FFT) of a signal.
  • ifft - Computes the 1D inverse discrete Fourier Transform (IFFT) of a signal.
  • rfft - Computes the 1D FFT of a real-valued input signal (one-sided spectrum).
  • irfft - Computes the 1D inverse FFT of a one-sided real FFT result.
  • stft - Computes the Short-Time Fourier Transform (STFT) of a signal.
  • istft - Inverse Short-time Fourier Transform.
  • vmap - vmap is the vectorizing map; vmap(func) returns a new function that
  • validateDevice - Validates that a value is a valid DeviceType at runtime.
  • broadcastShapes - Broadcasting utilities for tensor operations.
  • needsBroadcast - Check if shapeA needs broadcasting to match shapeB.
  • canBroadcastTo - Check if a shape is broadcastable to a target shape.
  • memory_stats - Returns memory statistics from the WebGPU buffer allocator.
  • memory_summary - Returns a human-readable summary of WebGPU memory usage.
  • empty_cache - Releases all unoccupied cached memory from the allocator.
  • reset_peak_memory_stats - Resets the peak memory statistics counter.

KernelRegistry

  • registerKernel - Register a kernel for (op, dtype, device).
  • getKernel - Get a kernel for (op, dtype, device).
  • hasKernel - Check if a kernel exists for (op, dtype, device).
  • findKernelWithPredicate - Find a kernel that matches the predicate, if any.
  • registerScalarKernel - Register a scalar kernel for (op, dtype, device).
  • getScalarKernel - Get a scalar kernel for (op, dtype, device).
  • hasScalarKernel - Check if a scalar kernel exists for (op, dtype, device).
  • registerAutograd - Register autograd for an operation.
  • getAutograd - Get autograd for (op, dtype, device).
  • hasAutograd - Check if autograd is registered for (op, dtype, device).
  • registerDType - Register a custom dtype.
  • getDType - Get dtype info.
  • hasDType - Check if a dtype is registered.
  • listCustomDTypes - List all registered custom dtypes.
  • registerFunction - Register a custom function.
  • getFunction - Get a registered function.
  • hasFunction - Check if a function is registered.
  • registerMethod - Register a custom method.
  • getMethod - Get a registered method.
  • hasMethod - Check if a method is registered.
  • listOps - List all registered operations.
  • listDTypes - List all registered dtypes (both built-in and custom).
  • listKernels - List all registered kernels.
  • getOpInfo - Get info about a specific operation.
  • coverageReport - Generate coverage report.
  • listFunctions - List all registered functions.
  • listMethods - List all registered methods.

Types

  • DeterministicOptions - Options for use_deterministic_algorithms
  • Torch - The torch module type with all operations and sub-modules.
  • DeviceType - Device management for automatic CPU fallback.
  • DType - Supported data types for tensors.
  • TypedArray - Union type of all supported TypedArray types for CPU tensor storage.
  • TensorLike - Tensor type placeholder.
  • GradientsFor - Derive gradient return type from operation schema.
  • InputsFor - Derive input type from operation schema.
  • GradContext - Context for gradient computation.
  • SetupContextFn - Setup context function type.
  • BackwardFn - Backward function type.
  • AutogradDevice - Device type for autograd registration.
  • AutogradDType - DType type for autograd registration.
  • AutogradConfig - Autograd configuration for an operation.
  • AutogradEntry - Internal autograd entry stored in registry.
  • BufferUsage - Usage flags for device buffers.
  • DeviceBuffer - Abstract device buffer interface.
  • DispatchConfig - Configuration for dispatching a compute operation.
  • DeviceContext - Device context returned from initialization.
  • DeviceCapabilities - Device capabilities.
  • DeviceConfig - Configuration for registering a custom device.
  • DeviceEntry - Internal device entry stored in registry.
  • TupleOfLength - Create a tuple type of specific length.
  • DTypeComponents - Registry of dtype component information.
  • DTypeRegistry - Registry of all dtype names.
  • RegisteredDType - Union of all registered dtype names.
  • DTypeSerializationConfig - Serialization configuration for custom dtypes.
  • DTypeDisplayConfig - Display configuration for custom dtypes.
  • DTypeConfig - Configuration for registering a custom dtype.
  • DTypeEntry - Internal dtype entry stored in registry.
  • IsRegistryError - Check if a type is a registry error.
  • AssertNotError - Assert that a type is not a registry error.
  • op_not_found_error - Error: Operation not found in registry.
  • op_kind_mismatch_error - Error: Invalid operation kind.
  • dtype_not_found_error - Error: DType not found in registry.
  • dtype_components_mismatch_error - Error: DType components mismatch.
  • dtype_already_registered_error - Error: DType already registered.
  • kernel_not_registered_error - Error: Kernel not registered.
  • kernel_signature_mismatch_error - Error: Kernel signature mismatch.
  • autograd_not_registered_error - Error: Autograd not registered.
  • autograd_gradient_mismatch_error - Error: Autograd gradient shape mismatch.
  • function_already_registered_error - Error: Function already registered.
  • method_already_registered_error - Error: Method already registered.
  • method_dtype_not_supported_error - Error: Method dtype restriction violated.
  • invalid_config_error - Error: Invalid configuration.
  • registration_failed_error - Error: Registration failed.
  • DTypeInfo - Information about a registered dtype.
  • DTypeCoverageReport - Get a coverage report filtered by dtype.
  • TypedArrayFor - Map DType to its corresponding TypedArray type.
  • BinaryKernelCPU - CPU kernel signature for binary operations.
  • UnaryKernelCPU - CPU kernel signature for unary operations.
  • ReductionKernelCPU - CPU kernel signature for reduction operations.
  • KernelWebGPU - WebGPU kernel configuration.
  • TensorMeta - Tensor metadata for predicate functions.
  • KernelPredicate - Predicate function to determine if a kernel should be used.
  • BaseKernelConfig - Base kernel configuration options.
  • BinaryKernelConfigCPU - CPU kernel configuration for binary operations.
  • UnaryKernelConfigCPU - CPU kernel configuration for unary operations.
  • ReductionKernelConfigCPU - CPU kernel configuration for reduction operations.
  • KernelConfigWebGPU - WebGPU kernel configuration.
  • KernelConfig - Conditional kernel config type based on operation schema and device.
  • CPUKernelEntry - CPU kernel entry stored in registry.
  • KernelEntry - Internal kernel entry stored in registry.
  • OpSchemas - Central registry of all operation schemas.
  • OpName - Union of all operation names.
  • GetOpSchema - Get the schema for a specific operation.
  • GetOpKind - Get the kind of an operation ('binary', 'unary', 'reduction', etc.).
  • IsBinaryOpName - Check if an operation is a binary operation.
  • IsUnaryOpName - Check if an operation is a unary operation.
  • IsReductionOpName - Check if an operation is a reduction operation.
  • BinaryOpNames - Filter operation names to only binary operations.
  • UnaryOpNames - Filter operation names to only unary operations.
  • ReductionOpNames - Filter operation names to only reduction operations.
  • RegisterBackwardOptions - Options for register_backward.
  • RegisterDTypeOptions - Options for register_dtype.
  • CPUForwardFn - CPU kernel forward function signature.
  • CPUKernelConfig - CPU kernel configuration.
  • WebGPUKernelConfig - WebGPU kernel configuration.
  • RegisterKernelOptions - Common kernel registration options.
  • RegisterFunctionOptions - Options for register_function.
  • FunctionConfig - Full function configuration.
  • RegisterMethodOptions - Options for register_method.
  • MethodConfig - Full method configuration.
  • ScalarCPUForwardFn - CPU scalar kernel forward function signature.
  • ScalarCPUKernelConfig - CPU scalar kernel configuration.
  • ScalarWebGPUKernelConfig - WebGPU scalar kernel configuration.
  • ScalarKernelEntry - Scalar kernel entry stored in registry.
  • FunctionEntry - Information about a registered function.
  • MethodEntry - Information about a registered method.
  • KernelInfo - Information about a registered kernel.
  • OpInfo - Information about a registered operation.
  • ListOpsOptions - Options for listing operations.
  • ListKernelsOptions - Options for listing kernels.
  • CoverageReport - Coverage report for registered operations.
  • OpCoverageEntry - Coverage entry for a single operation.
  • DeviceRegistry - Core type definitions for the torch.library extensibility system.
  • Device - Union of all registered device types.
  • IdentityShape - Identity shape rule - output has same shape as input.
  • BroadcastShapeRule - Broadcast shape rule - shapes are broadcast together.
  • MatmulShapeRule - Matrix multiplication shape rule.
  • MMShapeRule - Matrix-matrix multiplication shape rule.
  • SameShapeRule - Same shape rule - both inputs must have identical shape.
  • ReductionShapeRule - Reduction shape rule - reduces along dimensions.
  • DotShapeRule - Dot product shape rule.
  • MVShapeRule - Matrix-vector multiplication shape rule.
  • ShapeRule - Union of all shape rules.
  • SameDTypeRule - Output dtype is same as input dtype.
  • PromoteDTypeRule - Output dtype is promoted according to promotion rules.
  • BooleanDTypeRule - Output dtype is always boolean.
  • FloatDTypeRule - Output dtype is always float.
  • DTypeRule - Union of all dtype rules.
  • BinaryOpSchema - Schema for binary operations (two inputs, one output).
  • UnaryOpSchema - Schema for unary operations (one input, one output).
  • UnaryOpParams - Helper type to extract params from a UnaryOpSchema.
  • ReductionOpSchema - Schema for reduction operations.
  • CreationOpSchema - Schema for creation operations.
  • ShapeOpSchema - Schema for shape operations.
  • OpSchema - Union of all operation schema types.
  • OpKind - Extract the kind from an operation schema.
  • IsBinaryOp - Check if an operation schema is binary.
  • IsUnaryOp - Check if an operation schema is unary.
  • IsReductionOp - Check if an operation schema is a reduction.
  • AddmmOptions - Options for addmm operation: out = beta * input + alpha * (mat1 @ mat2)
  • AddmvOptions - Options for addmv operation: out = beta * input + alpha * (mat @ vec)
  • AddrOptions - Options for addr operation: out = beta * input + alpha * (vec1 ⊗ vec2)
  • BaddbmmOptions - Options for baddbmm operation: out = beta * input + alpha * (batch1 @ batch2)
  • AddbmmOptions - Options for addbmm operation
  • TensordotOptions - Options for tensordot
  • CdistOptions - Options for cdist
  • PrintOptions - Options for set_printoptions.
  • EyeOptions - Options for torch.eye().
  • RandintOptions - Options for randint
  • RandintLikeOptions - Options for randint_like
  • RandomLikeOptions - Options for rand_like and randn_like
  • NormalOptions - Options for normal creation
  • MultinomialOptions - Options for multinomial sampling
  • MultinomialAsyncOptions - Options for async multinomial sampling
  • TriOptions - Options for tril and triu
  • CatOptions - Options for cat
  • StackOptions - Options for stack
  • IndicesOptions - Options for tril_indices and triu_indices
  • CombinationsOptions - Options for combinations
  • einops_error_invalid_pattern - Error: Pattern must contain exactly one '->'.
  • einops_error_dimension_mismatch - Error: Input pattern dimension count doesn't match tensor rank.
  • einops_error_undefined_axis - Error: Output axis not defined in input.
  • einops_error_ambiguous_decomposition - Error: Cannot infer multiple unknown axes in composite.
  • einops_error_anonymous_in_output - Error: Anonymous dimension (_) cannot be used in output pattern.
  • RearrangeShape -
  • ValidatedRearrangeShape - Validated shape that always extends readonly number[].
  • einops_error_reduce_undefined_output - Error: Reduce pattern output must be subset of input axes.
  • ReduceShape - Compute the output shape of a reduce operation.
  • ValidatedReduceShape - Validated reduce shape.
  • einops_error_repeat_missing_size - Error: Repeat requires axis size for new dimension.
  • AxesRecord - Axes record type for repeat function.
  • RepeatShape - Compute the output shape of a repeat operation.
  • ValidatedRepeatShape - Validated repeat shape.
  • PackShape - Compute pack output shape based on pattern.
  • UnpackShape - Compute unpack output shape based on pattern.
  • RearrangeOptions - Options for rearrange
  • ReduceOptions - Options for reduce
  • RepeatOptions - Options for repeat
  • ReduceOperation - Reduction operations supported by einops.reduce.
  • Ellipsis - Sentinel symbol representing ellipsis (...) in einsum sublist notation.
  • SubscriptIndex - Valid subscript index for einsum sublist notation.
  • SublistElement - Valid element in an einsum sublist.
  • Sublist - A sublist of dimension specifications for einsum.
  • EinsumOutputShape - Infer einsum output shape from equation and input shapes.
  • einsum_error_operand_count_mismatch - Error: operand count doesn't match equation
  • einsum_error_subscript_rank_mismatch - Error: subscript length doesn't match tensor rank
  • einsum_error_invalid_equation - Error: invalid equation format
  • einsum_error_unknown_output_index - Error: output subscript contains unknown index
  • einsum_error_dimension_mismatch - Error: dimension size mismatch for repeated index
  • einsum_error_index_out_of_range - Error: sublist index out of range
  • einsum_error_invalid_sublist_element - Error: invalid element in sublist
  • ValidateOperandCount - Validate that the number of operands matches the equation.
  • ValidateRanks - Validate that all operand ranks match their subscripts.
  • ValidateEinsum - Combined validation for einsum.
  • ValidatedEinsumShape - Validated einsum output shape.
  • EinsumOptions - Options for einsum operations
  • TakeAlongDimOptions - Options for take_along_dim.
  • DiagonalScatterOptions - Options for diagonal_scatter.
  • NonzeroOptions - Options for nonzero operation
  • SplitOptions - Options for split
  • ChunkOptions - Options for chunk
  • UnbindOptions - Options for unbind
  • RollOptions - Options for roll
  • Rot90Options - Options for rot90 operations
  • DiffOptions - Options for diff
  • RepeatInterleaveOptions - Options for repeat_interleave
  • AsStridedOptions - Options for as_strided operations
  • CumulativeOptions - Options for cumulative operations (cumsum, cumprod)
  • CumulativeOptionsWithDim - Options for cumulative operations when dim is passed in options object
  • DiagOptions - Options for diag.
  • AddcdivOptions - Options for addcdiv operation: input + value * tensor1 / tensor2
  • AddcmulOptions - Options for addcmul operation: input + value * tensor1 * tensor2
  • BinaryOptions - Options for binary operations that support out parameter
  • UnaryOptions - Options for unary operations that support out parameter
  • DiagEmbedOptions - Options for diag_embed operations
  • DiagFlatOptions - Options for diagflat operations
  • SearchSortedOptions - Options for searchsorted operations
  • BucketizeOptions - Options for bucketize operations
  • BincountOptions - Options for bincount operations
  • HistcOptions - Options for histc operations
  • HistogramResult - Result type for histogram operation
  • HistogramOptions - Options for histogram operations
  • ReductionOptions - Options for sum, mean, prod operations
  • StdVarOptions - Options for std and var operations
  • StdVarMeanOptions - Options for std_mean and var_mean operations
  • NormOptions - Options for norm operation
  • LogsumexpOptions - Options for logsumexp.
  • DistOptions - Options for dist.
  • AminmaxOptions - Options for aminmax.
  • NanReductionOptions - Options for nansum and nanmean.
  • CountNonzeroOptions - Options for count_nonzero.
  • QuantileOptions - Options for quantile operations
  • UniqueOptions - Options for unique operations
  • UniqueConsecutiveOptions - Options for unique_consecutive operations
  • CovOptions - Options for covariance operations
  • CumExtremeResult - Return type for cummax and cummin operations - supports both array and named access
  • BinaryDType - Supported dtypes for binary operations.
  • BinaryBackwardFn - Backward function for binary ops.
  • BinaryOpConfig - Configuration for registering a binary operation.
  • UnaryDType - Supported dtypes for unary operations.
  • SaveForBackward - What to save for backward pass.
  • UnaryBackwardFn - Backward function for unary ops.
  • UnaryOpConfig - Configuration for registering a unary operation.
  • UnaryOpFn - The function type returned by registerUnaryOp.
  • CeluFunctionalOptions - Options for celu functional operation.
  • DropoutFunctionalOptions - Options for dropout functional operation.
  • EluFunctionalOptions - Options for elu functional operation.
  • GluFunctionalOptions - Options for glu functional operation.
  • HardtanhFunctionalOptions - Options for hardtanh functional operation.
  • LeakyReluFunctionalOptions - Options for leaky_relu functional operation.
  • ReluFunctionalOptions - Options for relu functional operation.
  • RreluFunctionalOptions - Options for rrelu functional operation.
  • SoftminFunctionalOptions - Options for softmin functional operation.
  • SoftplusFunctionalOptions - Options for softplus functional operation.
  • WindowOptions - Options for window functions.
  • KaiserWindowOptions - Options for Kaiser window.
  • FFTOptions - Options for FFT operations.
  • STFTOptions - Short-time Fourier Transform.
  • ISTFTOptions - Computes the inverse Short-Time Fourier Transform (ISTFT).
  • Shape - Type-level shape computation for compile-time shape checking.
  • DynamicShape - A dynamic shape (runtime-determined).
  • Rank - Get the number of dimensions (rank) from a shape.
  • At - Get element at index from tuple.
  • Half - Divide a number by 2 (lookup table for common sizes).
  • Double - Multiply a number by 2 (lookup table for common sizes).
  • Triple - Multiply a number by 3 (lookup table for common sizes).
  • MultiplyBy - Multiply a dimension by a factor.
  • NegativeDim - Convert negative dimension to positive.
  • IsShapeError - Check if a type is a shape error (not a valid Shape).
  • ShapeErrorMessage - Extract the error message from a shape error type as a string literal.
  • matmul_error_inner_dimensions_do_not_match - Matmul inner dimension mismatch error.
  • batch_dimensions_do_not_match_error - Batch dimension mismatch error.
  • transpose_error_requires_2d_tensor - Transpose requires 2D tensor error.
  • broadcast_error_incompatible_dimensions - Broadcast dimension incompatibility error.
  • dimension_error_out_of_range - Dimension out of range error.
  • permute_error_dimension_count_mismatch - Permute dimension count mismatch error.
  • expand_error_incompatible - Expand incompatible shape error.
  • slice_error_out_of_bounds - Slice range error.
  • narrow_error_start_out_of_bounds - Narrow start out of bounds error.
  • narrow_error_length_exceeds_bounds - Narrow length exceeds bounds error.
  • embedding_bag_error_requires_2d_input - Embedding bag requires 2D input error.
  • Is2D - Check if a shape is 2D (for embedding_bag).
  • IsAtLeast1D - Type guard to check if a shape is at least 1-dimensional (not a scalar).
  • device_error_requires - Device error for operations that require a specific device.
  • ValidateDevice - Check if device is valid for an operation.
  • DeviceCheckedResult - Result type that checks device compatibility before returning the result.
  • CPUOnlyResult - Shorthand for CPU-only operation result.
  • WebGPUOnlyResult - Shorthand for WebGPU-only operation result.
  • CheckShapeError - Check if a shape is an error shape.
  • ShapeCheckedResult - Wraps a result type to check for shape errors in the result shape.
  • BinaryBroadcastResult - Result type for binary broadcast operations (add, sub, mul, div).
  • BroadcastShape - Compute broadcast shape for binary operations.
  • MatmulShape - Compute output shape of matmul with various input dimensions.
  • Matmul2DShape - Compute output shape of 2D matrix multiplication (strict).
  • TransposeShape - Compute output shape of 2D transpose (.t()).
  • MatrixTransposeShape - Compute output shape of matrix transpose (.mT, .mH).
  • OuterShape - Compute output shape of outer product.
  • TransposeDimsShape - Compute output shape of transpose(dim0, dim1).
  • PermuteShape - Apply permutation to shape.
  • RemoveDim - Remove a dimension from shape.
  • select_error_index_out_of_bounds - Select index out of bounds error.
  • SelectShape - Compute output shape of select operation with compile-time bounds checking.
  • ReplaceDim - Replace dimension at index with new size.
  • NarrowShape - Compute output shape of narrow operation with compile-time bounds checking.
  • SliceShape - Compute output shape of index operation with a range.
  • RangeSpec - Range specification for tensor slicing in the .at() method.
  • MaskSpec - Marker type for boolean mask tensors in indexing.
  • IndicesSpec - Marker type for index tensors in indexing.
  • IndexSpec - Index specification for a single dimension in .at() calls.
  • at_error_index_out_of_bounds - Index out of bounds error for .at() indexing.
  • AtShape - Compute output shape of .at() multi-dimensional indexing.
  • CumShape - Compute output shape of cumulative operations (cumsum, cumprod) with bounds checking.
  • transpose_dims_error_out_of_range - Transpose dimension out of range error.
  • TransposeDimsShapeChecked - Compute output shape of transpose(dim0, dim1) with bounds checking.
  • flip_error_dim_out_of_range - Flip dimension out of range error.
  • FlipShape - Compute output shape of flip operation with bounds checking.
  • split_error_dim_out_of_range - Split dimension out of range error.
  • chunk_error_dim_out_of_range - Chunk dimension out of range error.
  • unbind_error_dim_out_of_range - Unbind dimension out of range error.
  • ValidateSplitDim - Validate split dimension is within bounds.
  • ValidateChunkDim - Validate chunk dimension is within bounds.
  • ValidateUnbindDim - Validate unbind dimension is within bounds.
  • gather_error_dim_out_of_range - Gather dimension out of range error.
  • scatter_error_dim_out_of_range - Scatter dimension out of range error.
  • index_select_error_dim_out_of_range - Index select dimension out of range error.
  • GatherShape - Validate gather dim is within bounds and compute output shape.
  • ScatterShape - Validate scatter dim is within bounds.
  • IndexSelectShape - Compute output shape of index_select with bounds checking.
  • softmax_error_dim_out_of_range - Softmax dimension out of range error.
  • SoftmaxShape - Compute output shape of softmax with bounds checking.
  • linalg_error_not_square_matrix - Error for operations requiring square matrices.
  • linalg_error_requires_2d - Error for operations requiring 2D input.
  • linalg_error_requires_at_least_2d - Error for operations requiring at least 2D input.
  • ValidateSquareMatrix - Validate shape is a 2D square matrix.
  • ValidateBatchedSquareMatrix - Validate shape is at least 2D with square last two dimensions (for batched linalg).
  • CholeskyShape - Output shape of Cholesky decomposition.
  • InverseShape - Output shape of matrix inverse.
  • DetShape - Output shape of determinant.
  • TraceShape - Output shape of trace.
  • LUShape - Output shape of LU decomposition.
  • SVDShape - Output shape of SVD.
  • EigShape - Output shape of eigenvalue decomposition.
  • item_error_not_scalar - Error for item() called on non-scalar tensor.
  • ValidateScalar - Validate that a shape is a scalar (empty tuple).
  • ItemResult - Type annotation for item() return that preserves assignability.
  • DiagShape - Compute output shape of diag operation.
  • TileShape - Alias for RepeatShape (tile and repeat have the same semantics).
  • ExpandShape - Compute output shape of expand operation.
  • SafeExpandShape - Safe version of ExpandShape that returns DynamicShape on error instead of error type.
  • SqueezeShape - Compute output shape of squeeze.
  • UnsqueezeShape - Compute output shape of unsqueeze.
  • ReshapeShape - Compute output shape of reshape operation.
  • FlattenShape - Compute output shape of flatten.
  • InsertDim - Insert a dimension of given size at the specified position.
  • StackShape - Compute output shape of stack operation.
  • HalfDim - Halve a dimension in a shape (for GLU).
  • DoubleDim - Double a dimension in a shape (for repeat_interleave with single repeat).
  • ScaleDim - Scale (multiply) a dimension by a factor.
  • CatShape - Compute output shape of concatenation along a dimension.
  • Pool1dShape - Output shape for 1D pooling (input: [B, C, L] or [C, L]).
  • Pool2dShape - Output shape for 2D pooling (input: [B, C, H, W] or [C, H, W]).
  • Pool3dShape - Output shape for 3D pooling (input: [B, C, D, H, W] or [C, D, H, W]).
  • AdaptivePool2dShape - Output shape for adaptive pooling that targets a specific output size.
  • AdaptivePool1dShape - Output shape for adaptive 1D pooling.
  • Conv1dShape - Output shape for 1D convolution.
  • Conv2dShape - Output shape for 2D convolution.
  • Conv3dShape - Output shape for 3D convolution.
  • ConvTranspose2dShape - Output shape for transposed convolution (deconvolution).
  • HasShapeError - Check if a shape is an error type.
  • AssertNoShapeError - Assert that a shape is NOT an error.
  • ShapedTensor - A tensor with compile-time shape information.
  • TensorCreator - Type for tensor creation with variadic shape args.
  • DeviceOptions - Options for Device constructor
  • DeviceInput - Device input type - can be string, Device object, or device type.
  • GradFn - Gradient function for autograd.
  • TensorOptions - Options for tensor creation with compile-time dtype and device tracking.
  • TypedStorage - Typed array storage for CPU tensors.
  • TensorStorage - Discriminated union for tensor storage across devices.
  • WebGPUTensorData - Internal tensor data structure for WebGPU tensors.
  • CPUTensorData - Internal tensor data structure for CPU tensors.
  • TensorData - Union type for tensor data on any device.
  • SliceSpec - Slice specification for tensor indexing.
  • TypeOptions - Options for type conversion
  • SliceOptions - Options for slice operations
  • SliceScatterOptions - Options for slice_scatter operations
  • ToOptions - Options for to() operations
  • AlphaBetaOptions - Options for operations with alpha and beta (addmm, addmv, etc.)
  • ValueOptions - Options for operations with a value scaling factor (addcdiv, addcmul)
  • ClampOptions - Options for clamp/clip operations
  • TriangularOptions - Options for triangular operations (triu, tril) - simple diagonal offset only
  • DiagflatOptions - Options for diagflat operation - simple offset only
  • DiagonalOptions - Options for diagonal extraction operations (diagonal, diag) - with dimension support
  • SqueezeOptions - Options for squeeze operations
  • UnsqueezeOptions - Options for unsqueeze operations
  • FlattenOptions - Options for flatten operations
  • SizeOptions - Options for size operations
  • StrideOptions - Options for stride operations
  • ScatterReduceOptions - Options for scatter_reduce operations
  • IndexPutOptions - Options for index_put operations
  • PutOptions - Options for put operations
  • TrapezoidOptions - Options for trapezoid operations
  • SortOptions - Options for sort operations
  • IscloseOptions - Options for isclose operations
  • AllcloseOptions - Options for allclose operations
  • TopkOptions - Options for topk operations
  • KthvalueOptions - Options for kthvalue operations
  • LogitOptions - Options for logit operations
  • NanToNumOptions - Options for nan_to_num operations
  • LogOptions - Options for log operations
  • UniformOptions - Options for uniform_ operations
  • RandomOptions - Options for random_ operations
  • BernoulliOptions - Options for bernoulli operations
  • ExponentialOptions - Options for exponential_ operations
  • CauchyOptions - Options for cauchy_ operations
  • LogNormalOptions - Options for log_normal_ operations
  • GeometricOptions - Options for geometric_ operations
  • LuSolveOptions - Options for lu_solve operations