Documentation
¶
Index ¶
- func LinearCompute(Bias, Weights, OutputData []float32, inputLength int, inputFloat32 float32, ...)
- func LoadFlatDataFromCSV(filePath string) ([]float32, error)
- func LoadImageFromCSV(filename string) *tensor.Tensor
- func LoadMatrixFromCSV(filename string) (*tensor.Tensor, error)
- func MSE(predictions, targets *tensor.Tensor) float32
- func Sigmoid(x float32) float32
- func SigmoidDerivative(x float32) float32
- type BasicTrainer
- type BatchNormLayer
- func (bn *BatchNormLayer) Forward(x *tensor.Tensor) *tensor.Tensor
- func (l *BatchNormLayer) GetBias() *tensor.Tensor
- func (l *BatchNormLayer) GetWeights() *tensor.Tensor
- func (l *BatchNormLayer) SetBias(data []float32)
- func (l *BatchNormLayer) SetBiasAndShape(data []float32, shape []int)
- func (l *BatchNormLayer) SetWeights(data []float32)
- func (l *BatchNormLayer) SetWeightsAndShape(data []float32, shape []int)
- type ConvLayer
- func (c *ConvLayer) Backward(gradOutput *tensor.Tensor) *tensor.Tensor
- func (c *ConvLayer) BackwardWithLR(gradOutput *tensor.Tensor, learningRate float32) *tensor.Tensor
- func (c *ConvLayer) Forward(x *tensor.Tensor) *tensor.Tensor
- func (l *ConvLayer) GetBias() *tensor.Tensor
- func (l *ConvLayer) GetWeights() *tensor.Tensor
- func (l *ConvLayer) SetBias(data []float32)
- func (l *ConvLayer) SetBiasAndShape(data []float32, shape []int)
- func (l *ConvLayer) SetWeights(data []float32)
- func (l *ConvLayer) SetWeightsAndShape(data []float32, shape []int)
- func (c *ConvLayer) UpdateParameters(learningRate float32)
- func (c *ConvLayer) ZeroGrad()
- type Embedding
- func (e *Embedding) Backward(gradOutput *tensor.Tensor, learningRate float32) *tensor.Tensor
- func (e *Embedding) Forward(indices *tensor.Tensor) *tensor.Tensor
- func (e *Embedding) GetBias() *tensor.Tensor
- func (e *Embedding) GetWeights() *tensor.Tensor
- func (e *Embedding) Parameters() []*tensor.Tensor
- func (e *Embedding) SetBiasAndShape(data []float32, shape []int)
- func (e *Embedding) SetWeightsAndShape(data []float32, shape []int)
- func (e *Embedding) ZeroGrad()
- type FlattenLayer
- type Layer
- type LayerForTesting
- type LayerLoader
- type LinearLayer
- func (l *LinearLayer) Backward(x *tensor.Tensor, lr float32) *tensor.Tensor
- func (l *LinearLayer) Forward(x *tensor.Tensor) *tensor.Tensor
- func (l *LinearLayer) ForwardMultiThread(x *tensor.Tensor) *tensor.Tensor
- func (l *LinearLayer) ForwardSignalThread(x *tensor.Tensor) *tensor.Tensor
- func (l *LinearLayer) ForwardSignalThreadCompute(x *tensor.Tensor) *tensor.Tensor
- func (l *LinearLayer) GetBias() *tensor.Tensor
- func (l *LinearLayer) GetWeights() *tensor.Tensor
- func (l *LinearLayer) Parameters() []*tensor.Tensor
- func (l *LinearLayer) SetBias(data []float32)
- func (l *LinearLayer) SetBiasAndShape(data []float32, shape []int)
- func (l *LinearLayer) SetWeights(data []float32)
- func (l *LinearLayer) SetWeightsAndShape(data []float32, shape []int)
- func (l *LinearLayer) SetupBackward(x, out *tensor.Tensor)
- func (l *LinearLayer) ZeroGrad()
- type MaxPool2DLayer
- type Model
- type ModelInterface
- type ReLULayer
- func (r *ReLULayer) ActivationType() string
- func (r *ReLULayer) Backward(gradOutput *tensor.Tensor, learningRate float32) *tensor.Tensor
- func (r *ReLULayer) Forward(x *tensor.Tensor) *tensor.Tensor
- func (r *ReLULayer) GetBias() *tensor.Tensor
- func (r *ReLULayer) GetWeights() *tensor.Tensor
- func (r *ReLULayer) NegativeSlope() float32
- func (r *ReLULayer) Parameters() []*tensor.Tensor
- func (r *ReLULayer) SetInplace(inplace bool)
- func (r *ReLULayer) ZeroGrad()
- type SigmoidLayer
- type SoftmaxLayer
- type TrainerInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LinearCompute ¶
func LoadFlatDataFromCSV ¶
func LoadImageFromCSV ¶
func SigmoidDerivative ¶
Types ¶
type BasicTrainer ¶
type BasicTrainer struct { LossFunc func(predictions, targets *tensor.Tensor) float32 Verbose bool }
func NewBasicTrainer ¶
func NewBasicTrainer(lossFunc func(predictions, targets *tensor.Tensor) float32) *BasicTrainer
func (*BasicTrainer) Train ¶
func (t *BasicTrainer) Train(model ModelInterface, inputs, targets *tensor.Tensor, epochs int, learningRate float32)
func (*BasicTrainer) Validate ¶
func (t *BasicTrainer) Validate(model ModelInterface, inputs, targets *tensor.Tensor) float32
type BatchNormLayer ¶
func NewBatchNormLayer ¶
func NewBatchNormLayer(numFeatures int, eps, momentum float32) *BatchNormLayer
func (*BatchNormLayer) GetBias ¶
func (l *BatchNormLayer) GetBias() *tensor.Tensor
func (*BatchNormLayer) GetWeights ¶
func (l *BatchNormLayer) GetWeights() *tensor.Tensor
func (*BatchNormLayer) SetBias ¶
func (l *BatchNormLayer) SetBias(data []float32)
func (*BatchNormLayer) SetBiasAndShape ¶
func (l *BatchNormLayer) SetBiasAndShape(data []float32, shape []int)
func (*BatchNormLayer) SetWeights ¶
func (l *BatchNormLayer) SetWeights(data []float32)
func (*BatchNormLayer) SetWeightsAndShape ¶
func (l *BatchNormLayer) SetWeightsAndShape(data []float32, shape []int)
type ConvLayer ¶
type ConvLayer struct { InChannels int OutChannels int KernelSize int Stride int Padding int Weights *tensor.Tensor Bias *tensor.Tensor InputCache *tensor.Tensor GradWeights *tensor.Tensor GradBias *tensor.Tensor }
func NewConvLayer ¶
func (*ConvLayer) BackwardWithLR ¶
func (*ConvLayer) GetWeights ¶
func (*ConvLayer) SetBiasAndShape ¶
func (*ConvLayer) SetWeights ¶
func (*ConvLayer) SetWeightsAndShape ¶
func (*ConvLayer) UpdateParameters ¶
type Embedding ¶
type Embedding struct { Weights *tensor.Tensor GradWeights *tensor.Tensor VocabSize int EmbDim int LastIndices []int }
func NewEmbedding ¶
func (*Embedding) GetWeights ¶
func (*Embedding) Parameters ¶
func (*Embedding) SetBiasAndShape ¶
func (*Embedding) SetWeightsAndShape ¶
type FlattenLayer ¶
type FlattenLayer struct {
// contains filtered or unexported fields
}
func NewFlattenLayer ¶
func NewFlattenLayer() *FlattenLayer
func (*FlattenLayer) GetBias ¶
func (r *FlattenLayer) GetBias() *tensor.Tensor
func (*FlattenLayer) GetWeights ¶
func (r *FlattenLayer) GetWeights() *tensor.Tensor
type LayerForTesting ¶
type LayerLoader ¶
type LinearLayer ¶
type LinearLayer struct { InputDim int OutputDim int Weights *tensor.Tensor Bias *tensor.Tensor WeightsTransposed bool }
func NewLinearLayer ¶
func NewLinearLayer(inputDim, outputDim int) *LinearLayer
func (*LinearLayer) ForwardMultiThread ¶
func (l *LinearLayer) ForwardMultiThread(x *tensor.Tensor) *tensor.Tensor
func (*LinearLayer) ForwardSignalThread ¶
func (l *LinearLayer) ForwardSignalThread(x *tensor.Tensor) *tensor.Tensor
func (*LinearLayer) ForwardSignalThreadCompute ¶
func (l *LinearLayer) ForwardSignalThreadCompute(x *tensor.Tensor) *tensor.Tensor
func (*LinearLayer) GetBias ¶
func (l *LinearLayer) GetBias() *tensor.Tensor
func (*LinearLayer) GetWeights ¶
func (l *LinearLayer) GetWeights() *tensor.Tensor
func (*LinearLayer) Parameters ¶
func (l *LinearLayer) Parameters() []*tensor.Tensor
func (*LinearLayer) SetBias ¶
func (l *LinearLayer) SetBias(data []float32)
func (*LinearLayer) SetBiasAndShape ¶
func (l *LinearLayer) SetBiasAndShape(data []float32, shape []int)
func (*LinearLayer) SetWeights ¶
func (l *LinearLayer) SetWeights(data []float32)
func (*LinearLayer) SetWeightsAndShape ¶
func (l *LinearLayer) SetWeightsAndShape(data []float32, shape []int)
func (*LinearLayer) SetupBackward ¶
func (l *LinearLayer) SetupBackward(x, out *tensor.Tensor)
func (*LinearLayer) ZeroGrad ¶
func (l *LinearLayer) ZeroGrad()
type MaxPool2DLayer ¶
type MaxPool2DLayer struct { PoolSize int Stride int Padding int Input *tensor.Tensor ArgMax [][4]int OutputDim []int }
func NewMaxPool2DLayer ¶
func NewMaxPool2DLayer(poolSize, stride, padding int) *MaxPool2DLayer
func (*MaxPool2DLayer) Backward ¶
func (m *MaxPool2DLayer) Backward(gradOutput *tensor.Tensor) *tensor.Tensor
func (*MaxPool2DLayer) OutputShape ¶
func (m *MaxPool2DLayer) OutputShape() []int
type Model ¶
type Model struct { Layers []Layer LayerIndex2Name map[int]string LayerName2Index map[string]int // contains filtered or unexported fields }
func (*Model) PrintModel ¶
func (m *Model) PrintModel()
type ModelInterface ¶
type ReLULayer ¶
type ReLULayer struct {
// contains filtered or unexported fields
}
func NewLeakyReLULayer ¶
func NewReLULayer ¶
func NewReLULayer() *ReLULayer
func (*ReLULayer) ActivationType ¶
func (*ReLULayer) GetWeights ¶
func (*ReLULayer) NegativeSlope ¶
func (*ReLULayer) Parameters ¶
func (*ReLULayer) SetInplace ¶
type SigmoidLayer ¶
type SigmoidLayer struct { }
func NewSigmoidLayer ¶
func NewSigmoidLayer() *SigmoidLayer
func (*SigmoidLayer) Parameters ¶
func (s *SigmoidLayer) Parameters() []*tensor.Tensor
func (*SigmoidLayer) ZeroGrad ¶
func (s *SigmoidLayer) ZeroGrad()
type SoftmaxLayer ¶
type SoftmaxLayer struct {
// contains filtered or unexported fields
}
func NewSoftmaxLayer ¶
func NewSoftmaxLayer(axis int) *SoftmaxLayer
func (*SoftmaxLayer) GetAxis ¶
func (s *SoftmaxLayer) GetAxis() int
func (*SoftmaxLayer) SetAxis ¶
func (s *SoftmaxLayer) SetAxis(axis int)
type TrainerInterface ¶
type TrainerInterface interface { Train(model ModelInterface, inputs, targets *tensor.Tensor, epochs int, learningRate float32) Validate(model ModelInterface, inputs, targets *tensor.Tensor) float32 }
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
cmd
|
|
00_standalone_example
command
|
|
01_polynomial_regression
command
|
|
02_cnn_mnist_handwrite_recognize
command
|
|
03_autoencoder
command
|
|
04_variational_autoencoder
command
|
|
04_variational_autoencoder/py
command
|
|
06_layer_testing
command
|
|
07_autoencoder_compute_graph
command
|
|
data_store
|
|
datasets_loader
|
|
pkg
|
|
risc-v
|
|
rv64-core/cmd/vm
command
|
|
rv64-core/pkg/rv64/cmd/make
command
|
|
rv64-core/pkg/rv64/cmd/rv64
command
|
|
thirdparty
|
|
fp16_convert
Package float16 defines support for half-precision floating-point numbers.
|
Package float16 defines support for half-precision floating-point numbers. |
onnx-go/backend/simple
Package simple holds a very simple graph structure suitable to receive an onnx model
|
Package simple holds a very simple graph structure suitable to receive an onnx model |
onnx-go/backend/testbackend
Package testbackend provides a set of testing helper functions that test backend interface implementations.
|
Package testbackend provides a set of testing helper functions that test backend interface implementations. |
onnx-go/backend/testbackend/onnx
Package onnxtest contains an export of the onnx test files
|
Package onnxtest contains an export of the onnx test files |
onnx-go/backend/x/gorgonnx
Package gorgonnx creates a temporary graph that is compatible with backend.ComputationBackend.
|
Package gorgonnx creates a temporary graph that is compatible with backend.ComputationBackend. |
onnx-go/doc/introduction
command
Present displays slide presentations and articles.
|
Present displays slide presentations and articles. |
onnx-go/doc/introduction/samples
command
|
|
onnx-go/doc/introduction/utils
command
|
|
onnx-go/examples/emotions
command
|
|
onnx-go/examples/tiny_yolov2
command
|
|
onnx-go/internal/tools/dump
command
|
|
onnx-go/misc/viewer
command
|
|
tiktoken/cmd/tokenizer
command
|
|
tiktoken/internal/cmd
command
|
|
vision
|
|
Click to show internal directories.
Click to hide internal directories.