torch.tx.createLazyExpression
function createLazyExpression(pattern: string): LazyExpressionCreate a lazy expression from a pattern string.
The expression is parsed but not evaluated until .execute() is called.
This enables deferred computation with variable substitution.
Parameters
patternstring- The expression pattern to compile
Returns
LazyExpression– A LazyExpression that can be bound and executed laterExamples
// Create a lazy expression
const linear = $.lazy('x @ w + b');
// Bind variables incrementally
const withParams = linear.with({ w: weights, b: bias });
// Execute with different inputs
for (const batch of data) {
const output = withParams.execute({ x: batch });
// Process output...
}
// Or provide all at once
const result = linear.execute({ x: input, w: weights, b: bias });