Package-level declarations

Types

Link copied to clipboard
annotation class ContextDsl
Link copied to clipboard
interface ContextDslItem
Link copied to clipboard
class DefaultDataExecutionContext(val tensorDataFactory: TensorDataFactory = DenseTensorDataFactory(), val phase: Phase = Phase.EVAL, _hooks: ForwardHooks? = null) : ExecutionContext
Link copied to clipboard
Link copied to clipboard

Observer that can tap into execution events produced by an ExecutionContext.

Link copied to clipboard

Registry maintaining execution observers and providing helper methods to broadcast events.

Link copied to clipboard
data class ExecutionStats(val operationsExecuted: Long = 0, val totalExecutionTime: Long = 0, val averageExecutionTime: Double = if (operationsExecuted > 0) totalExecutionTime.toDouble() / operationsExecuted else 0.0, val tensorsCreated: Long = 0, val peakMemoryUsage: Long = 0)

Execution statistics

Link copied to clipboard
data class MemoryInfo(val totalMemory: Long, val usedMemory: Long, val freeMemory: Long = totalMemory - usedMemory, val usagePercentage: Double = (usedMemory.toDouble() / totalMemory) * 100.0)

Memory usage information

Link copied to clipboard
enum Phase : Enum<Phase>

Execution phase indicating whether modules should behave as training or evaluation.

Link copied to clipboard

Wrapper that delegates to a base ExecutionContext but overrides the phase field.

Link copied to clipboard

Extension of ExecutionContext that supports gradient recording and backward pass. This interface allows high-level training utilities to remain backend-agnostic while leveraging autograd capabilities when available.

Functions

Link copied to clipboard
fun createDataMap(executionContext: ExecutionContext = DefaultDataExecutionContext(), content: DataContextDsl.(executionContext: ExecutionContext) -> Unit): Map<String, Tensor<*, *>>
Link copied to clipboard
fun data(executionContext: ExecutionContext = DefaultDataExecutionContext(), content: DataContextDsl.(executionContext: ExecutionContext) -> Unit)
inline fun <T : DType, V> data(executionContext: ExecutionContext = DefaultDataExecutionContext(), noinline content: TypedDataContextDsl<T, V>.(executionContext: ExecutionContext) -> Tensor<T, V>): Tensor<T, V>
Link copied to clipboard
inline fun <R> eval(ctx: ExecutionContext, block: (ExecutionContext) -> R): R

Execute the given block with the phase set to EVAL, using a delegating context wrapper.

Link copied to clipboard
inline fun <R> train(ctx: ExecutionContext, block: (ExecutionContext) -> R): R

Execute the given block with the phase set to TRAIN, using a delegating context wrapper.