ScopedBuilder

Computation expression that wraps the body in a torch.NewDisposeScope(). Intermediate tensors are disposed automatically when the block completes. Tensors in the return value (including inside tuples, records, and unions) are kept alive past the scope.

Constructors

NameDescription
ScopedBuilder()

Instance members

NameDescription
this.Combine
this.Delay
this.For
this.Return
this.ReturnFrom
this.Run
this.TryFinally
this.TryWith
this.Using
this.While
this.Zero

ExplicitScopedBuilder

Computation expression that disposes every tensor created in its scope unless the tensor is moved to the outer scope explicitly with Tensor.keep. Unlike scoped, the return value is not traversed automatically.

Constructors

NameDescription
ExplicitScopedBuilder()

Instance members

NameDescription
this.Combine
this.Delay
this.For
this.Return
this.ReturnFrom
this.Run
this.TryFinally
this.TryWith
this.Using
this.While
this.Zero

ScopedCE

FunctionDescription
scopedComputation expression that wraps the body in a
torch.NewDisposeScope(). Intermediate tensors are disposed
automatically when the block completes.
scopedExplicitComputation expression that disposes intermediate tensors without inspecting
the return value. Call Tensor.keep for each tensor that must survive.

scoped

scoped

Computation expression that wraps the body in a torch.NewDisposeScope(). Intermediate tensors are disposed automatically when the block completes.

Returns ScopedBuilder


scopedExplicit

scopedExplicit

Computation expression that disposes intermediate tensors without inspecting the return value. Call Tensor.keep for each tensor that must survive.

Returns ExplicitScopedBuilder