Skip to content

nn.types #

interface Layer #

interface Layer[T] {
	output_shape() []int
	variables() []&autograd.Variable[T]
	forward(mut input autograd.Variable[T]) !&autograd.Variable[T]
}

Layer is a generic interface for a neural network layer.

interface Loss #

interface Loss {
	// loss(input &autograd.Variable, target &vtl.Tensor) &autograd.Variable
}

Loss is a generic interface for loss functions.

interface Optimizer #

interface Optimizer[T] {
mut:
	params        []&autograd.Variable[T]
	learning_rate f64
	update() !
	build_params(layers Layer[T])
}

Optimizer is a generic interface for all optimizers.