DefaultGraphExecutionContext

class DefaultGraphExecutionContext(val baseOps: TensorOps = VoidTensorOps(), val phase: Phase = Phase.EVAL, val tensorDataFactory: TensorDataFactory = DenseTensorDataFactory(), val hooks: ForwardHooks? = null, val memoryInfo: MemoryInfo = MemoryInfo.getEmptyInfo(), val executionStats: ExecutionStats = ExecutionStats(), val createTapeFactory: (GraphExecutionContext) -> ExecutionTape = { _ -> DefaultExecutionTape() }, val computeGraph: ComputeGraph? = null, baseSink: OpSink = NoOpSink) : GraphExecutionContext(source)

Constructors

Link copied to clipboard
constructor(baseOps: TensorOps = VoidTensorOps(), phase: Phase = Phase.EVAL, tensorDataFactory: TensorDataFactory = DenseTensorDataFactory(), hooks: ForwardHooks? = null, memoryInfo: MemoryInfo = MemoryInfo.getEmptyInfo(), executionStats: ExecutionStats = ExecutionStats(), createTapeFactory: (GraphExecutionContext) -> ExecutionTape = { _ -> DefaultExecutionTape() }, computeGraph: ComputeGraph? = null, baseSink: OpSink = NoOpSink)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open override val baseOps: TensorOps
Link copied to clipboard

Optional compute graph used by GraphSink presets.

Link copied to clipboard
Link copied to clipboard
open override val currentTape: ExecutionTape?

Current execution tape (null if not recording)

Link copied to clipboard
open override val executionStats: ExecutionStats
Link copied to clipboard
open override val hooks: ForwardHooks?
Link copied to clipboard
open override val memoryInfo: MemoryInfo
Link copied to clipboard
Link copied to clipboard
open override val ops: KspTensorOps
Link copied to clipboard
open override val phase: Phase
Link copied to clipboard
Link copied to clipboard
open override val tapeStack: TapeStack

Tape stack for nested execution contexts

Link copied to clipboard

Functions

Link copied to clipboard
open override fun backward(targets: List<Tensor<*, *>>, sources: List<Tensor<*, *>>)
Link copied to clipboard

Clear cached tensor references from the trace session. Call between training batches to prevent memory accumulation.

Link copied to clipboard
open override fun collectGarbage()

Force garbage collection

Link copied to clipboard
inline fun <R> record(block: DefaultGraphExecutionContext.() -> R): Pair<ExecutionTape?, R>

Convenience helper to record within a block and return the produced tape (and keep existing graph).

Link copied to clipboard
open override fun resetExecutionStats()

Reset execution statistics

Link copied to clipboard
open override fun startRecording()
Link copied to clipboard
open override fun stopRecording(): ExecutionTape?
Link copied to clipboard

Helper for internal use that returns the tape