SkainetScope

DSL Scope for Skainet that wraps a GraphExecutionContext and provides a more idiomatic way to interact with tensors and training loops.

Constructors

Link copied to clipboard

Properties

Link copied to clipboard

Functions

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

High-level recording block.

Link copied to clipboard
fun <T : DType, V> tensorOf(shape: Shape, dtype: KClass<T>, vararg values: Float): Tensor<T, V>

Create a tensor with specific shape and values.

Link copied to clipboard
fun trainStep(optimizer: Optimizer, vararg params: ModuleParameter<*, *>, block: SkainetScope.() -> Tensor<*, *>): Tensor<*, *>

Encapsulated training step.

Link copied to clipboard
fun <T : DType, V> Tensor<T, V>.withRequiresGrad(flag: Boolean = true): Tensor<T, V>

Mark a tensor as requiring gradients.