torch.tx.LazyExpression.with
lazyExpression.with(vars: Record<string, TensorOrNumber>): LazyExpressionBind variables without executing.
Returns a new LazyExpression with the updated bindings. This allows incremental binding of variables.
Parameters
varsRecord<string, TensorOrNumber>- Variables to bind
Returns
LazyExpression– A new LazyExpression with updated bindingsExamples
const expr = $.lazy('x @ w + b');
// Bind weights once
const withWeights = expr.with({ w, b });
// Bind input for each batch
for (const batch of batches) {
const result = withWeights.with({ x: batch }).execute();
}