storage

package
v0.0.0-...-61db93c Latest Latest
Warning

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

Go to latest
Published: May 14, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrLearnableNotFound = errors.New("learnable not found")
)

Functions

func LoadNN1

func LoadNN1(loader *Storage, filePath string) error

LoadNN1 opens the given file path

func SaveNN1

func SaveNN1(path string, item Item) error

SaveNN1 saves the model in the given path

Types

type Item

type Item struct {
	Cost    float64
	Weights []Weight
}

func NodesToItem

func NodesToItem(nodes ...*gorgonia.Node) Item

NodesToItem converts a list of nodes to an storage.Item

type Storage

type Storage struct {
	Cost       float64
	Learnables map[string]Weight
}

Storage is in charge of loading the weights from files

func NewStorage

func NewStorage() *Storage

NewStorage instantiates a storage

func (*Storage) AddWeights

func (l *Storage) AddWeights(weights ...Weight)

AddWeights adds weights to the storage

func (*Storage) LoadFile

func (l *Storage) LoadFile(filePath string) error

Load loads the weights in the given path

func (*Storage) TensorByName

func (l *Storage) TensorByName(name string) (tensor.Tensor, error)

TensorByName returns the tensor associated to a weight name

type Weight

type Weight struct {
	Name  string
	Value gorgonia.Value
}

func (*Weight) GobDecode

func (w *Weight) GobDecode(buf []byte) error

GobDecode implements the gob.GobDecoder interface

func (*Weight) GobEncode

func (w *Weight) GobEncode() ([]byte, error)

GobEncode implements the gob.GobEncoder interface

Jump to

Keyboard shortcuts

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