Versions in this module Expand all Collapse all v0 v0.0.1 Mar 7, 2024 Changes in this version + const HighestProtocol + var ADDITEMS rune = '\x90' + var APPEND rune = 'a' + var APPENDS rune = 'e' + var BINBYTES rune = 'B' + var BINBYTES8 rune = '\x8e' + var BINFLOAT rune = 'G' + var BINGET rune = 'h' + var BININT rune = 'J' + var BININT1 rune = 'K' + var BININT2 rune = 'M' + var BINPERSID rune = 'Q' + var BINPUT rune = 'q' + var BINSTRING rune = 'T' + var BINUNICODE rune = 'X' + var BINUNICODE8 rune = '\x8d' + var BUILD rune = 'b' + var BYTEARRAY8 rune = '\x96' + var DICT rune = 'd' + var DUP rune = '2' + var DefaultProtocol byte = 4 + var EMPTY_DICT rune = '}' + var EMPTY_LIST rune = ']' + var EMPTY_SET rune = '\x8f' + var EMPTY_TUPLE rune = ')' + var EXT1 rune = '\x82' + var EXT2 rune = '\x83' + var EXT4 rune = '\x84' + var ErrInvalidMagicNumber = errors.New("invalid pytorch magic number") + var ErrInvalidProtocolVersion = errors.New("invalid pytorch protocol version") + var FLOAT rune = 'F' + var FRAME rune = '\x95' + var FROZENSET rune = '\x91' + var GET rune = 'g' + var GLOBAL rune = 'c' + var INST rune = 'i' + var INT rune = 'I' + var LIST rune = 'l' + var LONG rune = 'L' + var LONG1 rune = '\x8a' + var LONG4 rune = '\x8b' + var LONG_BINGET rune = 'j' + var LONG_BINPUT rune = 'r' + var MARK rune = '(' + var MEMOIZE rune = '\x94' + var NEWFALSE rune = '\x89' + var NEWOBJ rune = '\x81' + var NEWOBJ_EX rune = '\x92' + var NEWTRUE rune = '\x88' + var NEXT_BUFFER rune = '\x97' + var NONE rune = 'N' + var OBJ rune = 'o' + var PERSID rune = 'P' + var POP rune = '0' + var POP_MARK rune = '1' + var PROTO rune = '\x80' + var PUT rune = 'p' + var READONLY_BUFFER rune = '\x98' + var REDUCE rune = 'R' + var SETITEM rune = 's' + var SETITEMS rune = 'u' + var SHORT_BINBYTES rune = 'C' + var SHORT_BINSTRING rune = 'U' + var SHORT_BINUNICODE rune = '\x8c' + var STACK_GLOBAL rune = '\x93' + var STOP rune = '.' + var STRING rune = 'S' + var TUPLE rune = 't' + var TUPLE1 rune = '\x85' + var TUPLE2 rune = '\x86' + var TUPLE3 rune = '\x87' + var UNICODE rune = 'V' + func Decode(filename string) (map[string]*ts.Tensor, error) + func Encode(model ts.Module, outputFile string) error + func FloatBits16to32(u16 uint16) uint32 + func GetFunctionName(i interface{}) string + func Load(filename string) (interface{}, error) + func LoadAll(vs *nn.VarStore, modelFile string) error + func LoadPartial(vs *nn.VarStore, modelFile string) ([]string, error) + func LoadWithUnpickler(filename string, newUnpickler func(r io.Reader) Unpickler) (interface{}, error) + func Loads(s string) (interface{}, error) + type BFloat16Storage struct + Data []half.BFloat16 + func (s *BFloat16Storage) DType() gotch.DType + func (s *BFloat16Storage) Device() gotch.Device + func (s *BFloat16Storage) GetData() interface{} + func (s *BFloat16Storage) SetFromFile(r io.Reader) error + func (s *BFloat16Storage) SetFromFileWithSize(r io.Reader, size int) error + type BFloat16StorageClass struct + func (s *BFloat16StorageClass) New(size int, location string) Storage + type BaseStorage struct + Location string + Size int + type BoolStorage struct + Data []bool + func (s *BoolStorage) DType() gotch.DType + func (s *BoolStorage) Device() gotch.Device + func (s *BoolStorage) GetData() interface{} + func (s *BoolStorage) SetFromFile(r io.Reader) error + func (s *BoolStorage) SetFromFileWithSize(r io.Reader, size int) error + type BoolStorageClass struct + func (s *BoolStorageClass) New(size int, location string) Storage + type ByteArray []byte + func NewByteArray() *ByteArray + func NewByteArrayFromSlice(slice []byte) *ByteArray + func (a *ByteArray) Get(i int) byte + func (a *ByteArray) Len() int + type ByteStorage struct + Data []uint8 + func (s *ByteStorage) DType() gotch.DType + func (s *ByteStorage) Device() gotch.Device + func (s *ByteStorage) GetData() interface{} + func (s *ByteStorage) SetFromFile(r io.Reader) error + func (s *ByteStorage) SetFromFileWithSize(r io.Reader, size int) error + type ByteStorageClass struct + func (s *ByteStorageClass) New(size int, location string) Storage + type Callable interface + Call func(args ...interface{}) (interface{}, error) + type CharStorage struct + Data []int8 + func (s *CharStorage) DType() gotch.DType + func (s *CharStorage) Device() gotch.Device + func (s *CharStorage) GetData() interface{} + func (s *CharStorage) SetFromFile(r io.Reader) error + func (s *CharStorage) SetFromFileWithSize(r io.Reader, size int) error + type CharStorageClass struct + func (s *CharStorageClass) New(size int, location string) Storage + type Dict []*DictEntry + func NewDict() *Dict + func (d *Dict) Get(key interface{}) (interface{}, bool) + func (d *Dict) Len() int + func (d *Dict) MustGet(key interface{}) interface{} + func (d *Dict) Set(key, value interface{}) + type DictEntry struct + Key interface{} + Value interface{} + type DictSetter interface + Set func(key, value interface{}) + type DoubleStorage struct + Data []float64 + func (s *DoubleStorage) DType() gotch.DType + func (s *DoubleStorage) Device() gotch.Device + func (s *DoubleStorage) GetData() interface{} + func (s *DoubleStorage) SetFromFile(r io.Reader) error + func (s *DoubleStorage) SetFromFileWithSize(r io.Reader, size int) error + type DoubleStorageClass struct + func (s *DoubleStorageClass) New(size int, location string) Storage + type FloatStorage struct + Data []float32 + func (s *FloatStorage) DType() gotch.DType + func (s *FloatStorage) Device() gotch.Device + func (s *FloatStorage) GetData() interface{} + func (s *FloatStorage) SetFromFile(r io.Reader) error + func (s *FloatStorage) SetFromFileWithSize(r io.Reader, size int) error + type FloatStorageClass struct + func (s *FloatStorageClass) New(size int, location string) Storage + type FrozenSet map[interface{}]frozenSetEmptyStruct + func (f *FrozenSet) Has(v interface{}) bool + func (f *FrozenSet) Len() int + func NewFrozenSetFromSlice(slice []interface{}) *FrozenSet + type GenericClass struct + Module string + Name string + func NewGenericClass(module, name string) *GenericClass + func (g *GenericClass) PyNew(args ...interface{}) (interface{}, error) + type GenericObject struct + Class *GenericClass + ConstructorArgs []interface{} + type HalfStorage struct + Data []half.Float16 + func (s *HalfStorage) DType() gotch.DType + func (s *HalfStorage) Device() gotch.Device + func (s *HalfStorage) GetData() interface{} + func (s *HalfStorage) SetFromFile(r io.Reader) error + func (s *HalfStorage) SetFromFileWithSize(r io.Reader, size int) error + type HalfStorageClass struct + func (s *HalfStorageClass) New(size int, location string) Storage + type IntStorage struct + Data []int32 + func (s *IntStorage) DType() gotch.DType + func (s *IntStorage) Device() gotch.Device + func (s *IntStorage) GetData() interface{} + func (s *IntStorage) SetFromFile(r io.Reader) error + func (s *IntStorage) SetFromFileWithSize(r io.Reader, size int) error + type IntStorageClass struct + func (s *IntStorageClass) New(size int, location string) Storage + type LimitedBufferReader struct + func NewLimitedBufferReader(r io.Reader, dataSize, scalarSize, bufferSize int) *LimitedBufferReader + func (br *LimitedBufferReader) HasNext() bool + func (br *LimitedBufferReader) ReadNext() ([]byte, error) + type List []interface + func (l *List) Append(v interface{}) + func (l *List) Get(i int) interface{} + func (l *List) Len() int + func NewList() *List + func NewListFromSlice(slice []interface{}) *List + type ListAppender interface + Append func(v interface{}) + type LongStorage struct + Data []int64 + func (s *LongStorage) DType() gotch.DType + func (s *LongStorage) Device() gotch.Device + func (s *LongStorage) GetData() interface{} + func (s *LongStorage) SetFromFile(r io.Reader) error + func (s *LongStorage) SetFromFileWithSize(r io.Reader, size int) error + type LongStorageClass struct + func (s *LongStorageClass) New(size int, location string) Storage + type ModelInfor struct + func LoadModelInfo(modelFile string) (*ModelInfor, error) + func NewModelInfor(weights map[string][]int64, dtype gotch.DType) *ModelInfor + func (m *ModelInfor) DType() gotch.DType + func (m *ModelInfor) Parameters() int + func (m *ModelInfor) String() string + type ObjectClass struct + func (o *ObjectClass) PyNew(args ...interface{}) (interface{}, error) + type OrderedDict struct + List *list.List + Map map[interface{}]*OrderedDictEntry + PyDict map[string]interface{} + func NewOrderedDict() *OrderedDict + func (o *OrderedDict) Get(k interface{}) (interface{}, bool) + func (o *OrderedDict) Len() int + func (o *OrderedDict) MustGet(key interface{}) interface{} + func (o *OrderedDict) PyDictSet(key, value interface{}) error + func (o *OrderedDict) Set(k, v interface{}) + type OrderedDictClass struct + func (*OrderedDictClass) Call(args ...interface{}) (interface{}, error) + type OrderedDictEntry struct + Key interface{} + ListElement *list.Element + Value interface{} + type PyAttrSettable interface + PySetAttr func(key string, value interface{}) error + type PyDictSettable interface + PyDictSet func(key, value interface{}) error + type PyNewable interface + PyNew func(args ...interface{}) (interface{}, error) + type PyStateSettable interface + PySetState func(state interface{}) error + type RebuildDeviceTensorFromNumpy struct + func (r *RebuildDeviceTensorFromNumpy) Call(args ...interface{}) (interface{}, error) + type RebuildMetaTensorNoStorage struct + func (r *RebuildMetaTensorNoStorage) Call(args ...interface{}) (interface{}, error) + type RebuildParameter struct + func (r *RebuildParameter) Call(args ...interface{}) (interface{}, error) + type RebuildQtensor struct + func (r *RebuildQtensor) Call(args ...interface{}) (interface{}, error) + type RebuildSparseCsrTensor struct + func (r *RebuildSparseCsrTensor) Call(args ...interface{}) (interface{}, error) + type RebuildSparseTensor struct + func (r *RebuildSparseTensor) Call(args ...interface{}) (interface{}, error) + type RebuildTensor struct + func (r *RebuildTensor) Call(args ...interface{}) (interface{}, error) + type RebuildTensorV2 struct + func (r *RebuildTensorV2) Call(args ...interface{}) (interface{}, error) + type Reconstructor struct + func (r *Reconstructor) Call(args ...interface{}) (interface{}, error) + type Set map[interface{}]setEmptyStruct + func (s *Set) Add(v interface{}) + func (s *Set) Has(v interface{}) bool + func (s *Set) Len() int + func NewSet() *Set + func NewSetFromSlice(slice []interface{}) *Set + type SetAdder interface + Add func(v interface{}) + type ShortStorage struct + Data []int16 + func (s *ShortStorage) DType() gotch.DType + func (s *ShortStorage) Device() gotch.Device + func (s *ShortStorage) GetData() interface{} + func (s *ShortStorage) SetFromFile(r io.Reader) error + func (s *ShortStorage) SetFromFileWithSize(r io.Reader, size int) error + type ShortStorageClass struct + func (s *ShortStorageClass) New(size int, location string) Storage + type Stop struct + func (s Stop) Error() string + type Storage interface + DType func() gotch.DType + Device func() gotch.Device + GetData func() interface{} + SetFromFile func(r io.Reader) error + SetFromFileWithSize func(r io.Reader, size int) error + type StorageClass interface + New func(size int, location string) Storage + type StorageTensor struct + RequiresGrad bool + Size []int64 + Source Storage + StorageOffset int64 + Stride []int64 + type Tuple []interface + func (t *Tuple) Get(i int) interface{} + func (t *Tuple) Len() int + func NewTupleFromSlice(slice []interface{}) *Tuple + type Unpickler struct + FindClass func(module, name string) (interface{}, error) + GetExtension func(code int) (interface{}, error) + MakeReadOnlyFunc func(interface{}) (interface{}, error) + NextBufferFunc func() (interface{}, error) + PersistentLoad func(interface{}) (interface{}, error) + func NewUnpickler(r io.Reader) Unpickler + func (up *Unpickler) Load() (interface{}, error)