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