Documentation ¶
Index ¶
- type MappingFunc
- type ParamsProvider
- func (p *ParamsProvider[T]) Delete(name string)
- func (p *ParamsProvider[T]) Get(name string) []T
- func (p *ParamsProvider[T]) Iterate(fn func(name string, data []T) error) error
- func (p *ParamsProvider[T]) Load(filename string) error
- func (p *ParamsProvider[T]) Pop(name string) []T
- func (p *ParamsProvider[T]) Set(name string, data []T)
- func (p *ParamsProvider[T]) WithNameMapping(fn MappingFunc) *ParamsProvider[T]
- func (p *ParamsProvider[T]) WithPreProcessing(fn PreProcessingFunc[T]) *ParamsProvider[T]
- type PreProcessingFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MappingFunc ¶
MappingFunc is a function that maps a parameter name to another name.
type ParamsProvider ¶
ParamsProvider is a provider of parameters for a PyTorch model.
func NewParamsProvider ¶
func NewParamsProvider[T float.DType]() *ParamsProvider[T]
NewParamsProvider returns a new ParamsProvider.
func (*ParamsProvider[T]) Delete ¶
func (p *ParamsProvider[T]) Delete(name string)
Delete deletes a parameter with the given name.
func (*ParamsProvider[T]) Get ¶
func (p *ParamsProvider[T]) Get(name string) []T
Get returns a parameter with the given name.
func (*ParamsProvider[T]) Iterate ¶
func (p *ParamsProvider[T]) Iterate(fn func(name string, data []T) error) error
Iterate iterates over all the parameters in the provider.
func (*ParamsProvider[T]) Load ¶
func (p *ParamsProvider[T]) Load(filename string) error
Load loads parameters from a PyTorch model.
func (*ParamsProvider[T]) Pop ¶
func (p *ParamsProvider[T]) Pop(name string) []T
Pop returns a parameter with the given name and remove it from the params list.
func (*ParamsProvider[T]) Set ¶
func (p *ParamsProvider[T]) Set(name string, data []T)
Set sets a parameter with the given name.
func (*ParamsProvider[T]) WithNameMapping ¶
func (p *ParamsProvider[T]) WithNameMapping(fn MappingFunc) *ParamsProvider[T]
WithNameMapping sets the name mapping function.
func (*ParamsProvider[T]) WithPreProcessing ¶
func (p *ParamsProvider[T]) WithPreProcessing(fn PreProcessingFunc[T]) *ParamsProvider[T]
WithPreProcessing sets the parameters pre-processing function.
type PreProcessingFunc ¶
type PreProcessingFunc[T float.DType] func(params *ParamsProvider[T]) error
PreProcessingFunc is a function that pre-processes parameters before the conversion.