conversion

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2022 License: BSD-2-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertType

func AssertType[T any](v any) (vt T, err error)

func AssignAssertedType

func AssignAssertedType[T any](v any, to *T) (err error)

func AssignDictToMap

func AssignDictToMap[K comparable, V any](d *types.Dict, m *map[K]V) (err error)

func AssignListToSlice

func AssignListToSlice[T any](l *types.List, s *[]T) (err error)

func AssignOptionalAssertedType

func AssignOptionalAssertedType[T any](v any, to **T) (err error)

func AssignTupleToSlice

func AssignTupleToSlice[T any](t *types.Tuple, s *[]T) (err error)

func DictToMap

func DictToMap[K comparable, V any](d *types.Dict) (map[K]V, error)

func GetTensorData

func GetTensorData(t *pytorch.Tensor) ([]float32, error)

GetTensorData returns the data of a PyTorch tensor as a mat.Float slice. It returns the data using the row-major representation, possibly converting column-major order to row-major order.

func ListToSlice

func ListToSlice[T any](l *types.List) ([]T, error)

func Tensor2DToSliceOfVectors

func Tensor2DToSliceOfVectors(t *pytorch.Tensor) ([]mat.Matrix, error)

func TupleToSlice

func TupleToSlice[T any](t *types.Tuple) ([]T, error)

Types

type PyAttributeGettable

type PyAttributeGettable interface {
	PyGetAttribute(name string) (value any, exists bool, err error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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