Skip to main content
torch.js has not been released yet. how did you find this? check back soon, we're preparing for v0.1 now
torch.jstorch.jstorch.js
PlaygroundContact
Login
Documentation
IntroductionType SafetyTensor ExpressionsTensor IndexingEinsumEinopsAutogradTraining a ModelProfiling & MemoryPyTorch MigrationBest PracticesRuntimesPerformancePyTorch CompatibilityBenchmarksDType Coverage
acquireAnalysisHintAnalysisResultanalyzeanalyzeanalyzeExpressionAssignmentNodeASTNodeastToMethodChainastToStringBinaryOpNodebindBufferPoolbuildExpressionStringbuildGraphChainedComparisonNodeclearclearAstCacheclearBufferPoolclonecloneCompiledExecuteOptionsCompiledExpressionCompiledPatterncompileExpressioncompileExpressionWithCompileOptionscompilePatterncomposePatternscreateEfficientPatterncreateLazyExpressioncreateLazyExpressionWithCustomOperatorDefinitionDeviceOfDimensionLabeledNodeDTypeOfEfficientOptionsEvalExprShapeevaluateevaluateEfficientEvaluateOptionsevaluateWithTraceEvaluationErrorexecuteExpressionGraphextractVariablesExtractVariablesformatAnalysisFunctionCallNodeFunctionDefinitionFunctionInfogetASTgetAstCacheSizegetAutocompleteInfogetBufferPoolgetCustomOperatorgetFunctionRegistrygetOperatorOverloadsgetOperatorsgetOptimizedExpressiongradgradAllGraphEdgeGraphNodegraphToStringhasFunctionhasOperatorInferDeviceInferDTypeInferExpressionShapeInferObjectDeviceInferObjectDTypeinitBuiltinFunctionsisOperatorLazyExecuteOptionsLazyExpressionNamedExpressionNumberNodeOperatorOperatorOverloadparseParseErrorParseExprPatternParseResultparseTemplatepartialPatternpattern_error_extra_variablespattern_error_missing_variablesPatternExprResultPatternExprShapePatternFunctionPatternVariablespipePatternsregisterFunctionregisterOperatorregisterOperatorOverloadreleasereleaseAllrunsetBufferPoolSeverityShapeAssertionNodeShapeDimensionShapeOfStringNodeTensorExprResultTensorOrNumberTensorRefNodeTensorShapeMapTernaryNodeTokentokenizeTokenizerErrorTokenizerResultTokenTypetoStringtoStringTraceEntryTraceResultTypedTensorExprTypedTensorExprWithHelpersUnaryOpNodeunbindunbindValidatePatternVariablesvisualizeGraphVisualizeOptionswithwithPoolScope
absacosacoshAdaptivePool1dShapeAdaptivePool2dShapeaddaddbmmAddbmmOptionsaddcdivAddcdivOptionsaddcmulAddcmulOptionsaddmmAddmmOptionsaddmvAddmvOptionsaddrAddrOptionsadjointallallcloseAllcloseOptionsAlphaBetaOptionsamaxaminaminmaxAminmaxOptionsangleanyapplyOutarangeare_deterministic_algorithms_enabledargmaxargminargsortargwhereas_stridedas_tensorasinasinhAssertNoShapeErrorAssertNotErrorAsStridedOptionsAtat_error_index_out_of_boundsatanatan2atanhatleast_1datleast_2datleast_3dAtShapeautocast_decrement_nestingautocast_increment_nestingautograd_gradient_mismatch_errorautograd_not_registered_errorAutogradConfigAutogradEntryAutogradHandleAutogradHandleImplAxesRecordBackwardFnbaddbmmBaddbmmOptionsbartlett_windowBaseKernelConfigbatch_dimensions_do_not_match_errorbernoulliBernoulliOptionsBinaryBroadcastResultBinaryKernelConfigCPUBinaryKernelCPUBinaryOpNamesBinaryOpSchemaBinaryOptionsbincountBincountOptionsbitwise_andbitwise_left_shiftbitwise_notbitwise_orbitwise_right_shiftbitwise_xorblackman_windowblock_diagbmmBooleanDTypeRulebroadcast_error_incompatible_dimensionsbroadcast_shapesbroadcast_tensorsbroadcast_toBroadcastShapeBroadcastShapeRulebroadcastShapesbucketizeBucketizeOptionsbuildEinopsErrorbuildErrorMessagecanBroadcastTocartesian_prodcatCatOptionsCatShapeCauchyOptionscdistCdistOptionsceilceluCeluFunctionalOptionschain_matmulCheckShapeErrorCholeskyShapechunkchunk_error_dim_out_of_rangeChunkOptionsclampClampOptionsclear_autocast_cacheclearEinopsCacheclearEinsumCacheclonecolumn_stackcombinationsCombinationsOptionscompiled_with_cxx11_abicomplexconjconj_physicalcontiguousConv1dShapeConv2dShapeConv3dShapeConvTranspose2dShapecopysigncorrcoefcoscoshcount_nonzeroCountNonzeroOptionscovcoverage_reportcoverageReportCoverageReportCovOptionsCPUForwardFnCPUKernelConfigCPUKernelEntryCPUOnlyResultCPUTensorDatacreateTorchCreationOpSchemaCumExtremeResultcummaxcummincumprodCumShapecumsumcumulative_trapezoidCumulativeOptionsCumulativeOptionsWithDimdeg2raddetachDeterministicOptionsDetShapeDevicedevice_error_requiresDeviceCheckedResultDeviceInputDeviceOptionsDeviceTypediagdiag_embedDiagEmbedOptionsdiagflatDiagflatOptionsDiagFlatOptionsdiagonal_scatterDiagonalOptionsDiagonalScatterOptionsDiagOptionsDiagShapediffDiffOptionsdigammadimension_error_out_of_rangedistDistOptionsdivdotDotShapeRuleDoubleDoubleDimdropoutDropoutFunctionalOptionsdsplitdstackDTypedtype_already_registered_errordtype_components_mismatch_errordtype_not_found_errorDTypeComponentsDTypeConfigDTypeDisplayConfigDTypeEntryDTypeHandleDTypeHandleImplDTypeRegistryDTypeRuleDTypeSerializationConfigDynamicShapeEigShapeeinops_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_moduleget_file_pathget_float32_matmul_precisionget_num_interop_threadsget_num_threadsget_op_infoget_printoptionsget_real_dtypeget_rng_stategetAutogradgetDTypegetEinopsCacheSizegetEinsumCacheSizegetFunctiongetKernelgetMethodgetOpInfoGetOpKindGetOpSchemagetScalarKernelgluGluFunctionalOptionsGradContextGradFnGradientsForgtHalfHalfDimhamming_windowhann_windowhardshrinkhardsigmoidhardswishhardtanhhardtanh_HardtanhFunctionalOptionshas_autogradhas_kernelhasAutogradhasDTypehasFunctionhasKernelhasMethodhasScalarKernelHasShapeErrorheavisidehistcHistcOptionshistogramHistogramOptionsHistogramResulthsplithstackhypoti0IdentityShapeifftimagindex_addindex_copyindex_fillindex_putindex_reduceindex_selectindex_select_error_dim_out_of_rangeIndexPutOptionsIndexSelectShapeIndexSpecIndicesOptionsIndicesSpecInputsForInsertDiminvalid_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_dtypeslist_dtypeslist_functionslist_kernelslist_methodslist_opslistCustomDTypeslistDTypeslistFunctionslistKernelsListKernelsOptionslistMethodslistOpsListOpsOptionsloglog_softmaxlog10log1plog2logaddexplogaddexp2logcumsumexplogical_andlogical_notlogical_orlogical_xorlogitLogitOptionsLogNormalOptionsLogOptionslogsigmoidlogspacelogsumexpLogsumexpOptionsltLUShapeLuSolveOptionsmasked_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_dtyperegister_forwardregister_functionregister_methodregister_scalar_forwardregisterAutogradRegisterBackwardOptionsregisterDTypeRegisterDTypeOptionsRegisteredDTyperegisterFunctionRegisterFunctionOptionsregisterKernelRegisterKernelOptionsregisterMethodRegisterMethodOptionsregisterScalarKernelregistration_failed_errorrelurelu_relu6ReluFunctionalOptionsremainderRemoveDimrepeatrepeat_interleaveRepeatInterleaveOptionsRepeatOptionsRepeatShapeReplaceDimrequireWebGPUreset_peak_memory_statsreshapeReshapeShaperesult_typerfftrollRollOptionsrot90Rot90Optionsroundrrelurrelu_RreluFunctionalOptionsrsqrtSafeExpandShapeSameDTypeRuleSameShapeRuleScalarCPUForwardFnScalarCPUKernelConfigScalarKernelEntryScalarKernelHandleScalarWebGPUKernelConfigScaleDimscatterscatter_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_dividetruncTupleOfLengthTypedArrayTypedArrayForTypedStorageTypeOptionsUnaryKernelConfigCPUUnaryKernelCPUUnaryOpNamesUnaryOpParamsUnaryOpSchemaUnaryOptionsunbindunbind_error_dim_out_of_rangeUnbindOptionsunflattenUniformOptionsuniqueunique_consecutiveUniqueConsecutiveOptionsUniqueOptionsunpackUnpackShapeunravel_indexunsqueezeUnsqueezeOptionsUnsqueezeShapeuse_deterministic_algorithmsValidateBatchedSquareMatrixValidateChunkDimValidatedEinsumShapevalidateDeviceValidateDeviceValidatedRearrangeShapeValidatedReduceShapeValidatedRepeatShapevalidateDTypeValidateEinsumValidateOperandCountValidateRanksValidateScalarValidateSplitDimValidateSquareMatrixValidateUnbindDimValueOptionsvar_var_meanvdotviewview_as_complexview_as_realvmapvsplitvstackWebGPUKernelConfigWebGPUOnlyResultWebGPUTensorDatawhereWindowOptionsxlogyzeroszeros_like
torch.js· 2026
LegalTerms of UsePrivacy Policy
/
/
  1. docs
  2. torch.js
  3. torch
  4. tx

torch.tx

Functions

  • compileExpression - Compile an expression with advanced features.
  • compileExpressionWith - Compile an expression with initial bindings.
  • compilePattern - Compile a pattern string into a reusable pattern object.
  • composePatterns - Compose two patterns together.
  • pipePatterns - Pipe multiple patterns together.
  • partialPattern - Create a partial application of a pattern.
  • evaluate - Evaluate an AST with the given tensor values.
  • evaluateWithTrace - Evaluate an AST with tracing enabled.
  • grad - Compute the symbolic derivative of a pattern with respect to a variable.
  • gradAll - Compute multiple symbolic derivatives at once.
  • getAstCacheSize - Get current cache size (exported for testing)
  • clearAstCache - Clear the AST cache (exported for testing)
  • createLazyExpression - Create a lazy expression from a pattern string.
  • createLazyExpressionWith - Create a lazy expression with initial bindings.
  • getBufferPool - Get the global buffer pool.
  • setBufferPool - Set the global buffer pool.
  • clearBufferPool - Clear the global buffer pool.
  • evaluateEfficient - Evaluate an expression efficiently with optional output buffer.
  • createEfficientPattern - Create a curried efficient evaluation function.
  • withPoolScope - Execute a function with automatic buffer cleanup.
  • analyzeExpression - Analyze an AST for optimization opportunities.
  • formatAnalysis - Format analysis results as a human-readable string.
  • parse - Parse an expression string into an AST.
  • parseTemplate - Parse from a tagged template literal.
  • astToString - Convert AST to string representation (for debugging/hover preview).
  • astToMethodChain - Convert AST to method chain string (for hover preview).
  • registerFunction - Register a custom function for use in tensor expressions.
  • getFunctionRegistry - Get the function registry.
  • hasFunction - Check if a function is registered.
  • getAutocompleteInfo - Get autocomplete information for all registered functions.
  • getOperators - Get list of available operators.
  • registerOperatorOverload - Register an operator overload.
  • getOperatorOverloads - Get operator overloads for an operator.
  • registerOperator - Register a custom binary operator.
  • getCustomOperator - Get custom operator definition.
  • hasOperator - Check if an operator is registered.
  • initBuiltinFunctions - Initialize the built-in function registry.
  • extractVariables - Extract variable names from a pattern string.
  • isOperator - Check if a string is a valid operator.
  • tokenize - Tokenize an expression string with tensor placeholders.
  • buildExpressionString - Build expression string from tagged template literal parts.
  • buildGraph - Build a structured graph from an AST.
  • visualizeGraph - Render a graph as ASCII art.
  • graphToString - Create a compact string representation of the graph.

CompiledExpression

  • bind - Bind variables without executing.
  • run - Run the compiled expression.
  • analyze - Get analysis of the expression.
  • getOptimizedExpression - Get a string representation of the optimized AST.
  • toString - Get a summary of the compiled expression.
  • unbind - Create a copy with no bindings.
  • clone - Clone with current bindings.

LazyExpression

  • with - Bind variables without executing.
  • execute - Execute the expression with current bindings.
  • analyze - Get analysis hints for this expression.
  • getAST - Get the AST representation of this expression.
  • toString - Convert the expression to a string representation.
  • unbind - Create a copy of this expression with no bindings.
  • clone - Clone this expression with its current bindings.

BufferPool

  • acquire - Acquire a buffer with the given shape and dtype.
  • release - Release a buffer back to the pool.
  • releaseAll - Release multiple buffers at once.
  • clear - Clear all pooled buffers.

Types

  • CompiledExecuteOptions - Options for compiled expression execution.
  • CompileOptions - Options for compiling an expression.
  • CompiledPattern - A compiled pattern that can be evaluated with tensors.
  • NamedExpression - Create a named expression that can be inspected and composed.
  • EvaluateOptions -
  • TraceEntry - A single entry in the evaluation trace.
  • TraceResult - Result of evaluate with tracing enabled.
  • LazyExecuteOptions - Options for lazy expression execution.
  • EfficientOptions - Options for efficient evaluation.
  • Severity - Severity level for analysis results
  • AnalysisHint - A single analysis result
  • AnalysisResult - Complete analysis result
  • ASTNode -
  • NumberNode -
  • StringNode -
  • TensorRefNode -
  • DimensionLabeledNode - A tensor reference with dimension labels for validation.
  • UnaryOpNode -
  • BinaryOpNode -
  • TernaryNode -
  • ChainedComparisonNode -
  • FunctionCallNode -
  • AssignmentNode -
  • ShapeDimension - Shape dimension: number for exact match, null for wildcard (_)
  • ShapeAssertionNode -
  • ParseResult -
  • FunctionDefinition -
  • FunctionInfo - Autocomplete information for a function
  • OperatorOverload -
  • CustomOperatorDefinition -
  • TokenType - Tokenizer for tensor expressions.
  • Token -
  • Operator -
  • TokenizerResult -
  • TokenizerError -
  • TensorOrNumber - Tensor or scalar number
  • ShapeOf - Extract shape from a Tensor type.
  • DTypeOf - Extract DType from a Tensor type, defaulting to 'float32' for scalars.
  • DeviceOf - Extract Device from a Tensor type, defaulting to DeviceType for scalars.
  • InferDType - Infer dtype from a tuple of tensors.
  • InferDevice - Infer device from a tuple of tensors.
  • InferExpressionShape - Infer result shape from template strings and interpolated tensors.
  • TensorExprResult - Compute the full result tensor type for a tensor expression.
  • PatternFunction - Type signature for the $ tagged template function.
  • TypedTensorExpr - Tensor expression DSL with two distinct modes:
  • ParseExprPattern - Parse an expression pattern into an AST at the type level.
  • EvalExprShape - Evaluate a parsed AST to compute the result shape.
  • PatternExprShape - Compute the result shape for a pattern expression.
  • ExtractVariables - Extract all variable names from a parsed AST.
  • PatternVariables - Extract all variable names from a pattern string.
  • pattern_error_missing_variables - Error type for missing variables in pattern expression.
  • pattern_error_extra_variables - Error type for extra/unused variables in pattern expression.
  • ValidatePatternVariables - Validate that a tensor object's keys match the pattern's variables.
  • TensorShapeMap - Extract shape map from a tensor object.
  • InferObjectDType - Infer dtype from a tensor object (uses first tensor's dtype).
  • InferObjectDevice - Infer device from a tensor object (uses first tensor's device).
  • PatternExprResult - Result type for pattern-based expression evaluation.
  • TypedTensorExprWithHelpers - Full tensorExpr interface including utilities.
  • GraphNode - A node in the computation graph
  • GraphEdge - An edge in the computation graph
  • ExpressionGraph - Structured graph representation of an expression
  • VisualizeOptions - Options for ASCII visualization