training

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 4, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package training provides core components for neural network training.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Model

type Model[T tensor.Numeric] interface {
	// Forward performs the forward pass of the model.
	Forward(inputs ...*tensor.Tensor[T]) *tensor.Tensor[T]
	// Backward performs the backward pass of the model.
	Backward(grad *tensor.Tensor[T]) []*tensor.Tensor[T]
	// Parameters returns the parameters of the model.
	Parameters() []*graph.Parameter[T]
}

Model defines the interface for a trainable model.

type Trainer

type Trainer[T tensor.Numeric] struct {
	// contains filtered or unexported fields
}

Trainer encapsulates the training logic for a model.

func NewTrainer

func NewTrainer[T tensor.Numeric](model Model[T], optimizer optimizer.Optimizer[T], lossFn loss.Loss[T]) *Trainer[T]

NewTrainer creates a new trainer.

func (*Trainer[T]) Train

func (t *Trainer[T]) Train(inputs, targets *tensor.Tensor[T]) (T, error)

Train performs a single training step.

Directories

Path Synopsis
Package loss provides various loss functions for neural networks.
Package loss provides various loss functions for neural networks.
Package optimizer provides various optimization algorithms for neural networks.
Package optimizer provides various optimization algorithms for neural networks.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL