Documentation ¶
Overview ¶
Package dtype provides a definition of a Dtype, which is a part of the type system that Gorgonia uses.
Index ¶
- Variables
- func ID(a Dtype) int
- func Register(a Dtype)
- func RegisterEq(a Dtype)
- func RegisterFloat(a Dtype)
- func RegisterNumber(a Dtype)
- func RegisterOrd(a Dtype)
- func TypeClassCheck(a Dtype, in TypeClass) error
- type Dtype
- func (dt Dtype) Apply(hm.Subs) hm.Substitutable
- func (dt Dtype) Eq(other hm.Type) bool
- func (dt Dtype) Format(s fmt.State, c rune)
- func (dt Dtype) FreeTypeVar() hm.TypeVarSet
- func (dt Dtype) Normalize(k, v hm.TypeVarSet) (hm.Type, error)
- func (dt Dtype) NumpyDtype() (string, error)
- func (dt Dtype) Types() hm.Types
- type TypeClass
Constants ¶
This section is empty.
Variables ¶
var ( Bool = Dtype{reflect.TypeOf(true)} Int = Dtype{reflect.TypeOf(int(1))} Int8 = Dtype{reflect.TypeOf(int8(1))} Int16 = Dtype{reflect.TypeOf(int16(1))} Int32 = Dtype{reflect.TypeOf(int32(1))} Int64 = Dtype{reflect.TypeOf(int64(1))} Uint = Dtype{reflect.TypeOf(uint(1))} Uint8 = Dtype{reflect.TypeOf(uint8(1))} Uint16 = Dtype{reflect.TypeOf(uint16(1))} Uint32 = Dtype{reflect.TypeOf(uint32(1))} Uint64 = Dtype{reflect.TypeOf(uint64(1))} Float32 = Dtype{reflect.TypeOf(float32(1))} Float64 = Dtype{reflect.TypeOf(float64(1))} Complex64 = Dtype{reflect.TypeOf(complex64(1))} Complex128 = Dtype{reflect.TypeOf(complex128(1))} String = Dtype{reflect.TypeOf("")} // aliases Byte = Uint8 // extras Uintptr = Dtype{reflect.TypeOf(uintptr(0))} UnsafePointer = Dtype{reflect.TypeOf(unsafe.Pointer(&Uintptr))} )
oh how nice it'd be if I could make them immutable
Functions ¶
func RegisterEq ¶
func RegisterEq(a Dtype)
RegisterEq registers a dtype as a type whose values can be compared for equality.
func RegisterFloat ¶
func RegisterFloat(a Dtype)
RegisterFloat registers a dtype as a type whose values are floating points. This implies that NaN, +Inf and -Inf are also well as values in this type.
func RegisterNumber ¶
func RegisterNumber(a Dtype)
RegisterNumber is a function required to register a new numerical Dtype. This package provides the following Dtype:
Int Int8 Int16 Int32 Int64 Uint Uint8 Uint16 Uint32 Uint64 Float32 Float64 Complex64 Complex128
If a Dtype that is registered already exists on the list, it will not be added to the list.
Types ¶
type Dtype ¶
Dtype represents a data type of a Tensor. Concretely it's implemented as an embedded reflect.Type which allows for easy reflection operations. It also implements hm.Type, for type inference in Gorgonia
func FindByName ¶
FindByName finds a given type by its name.
func FromNumpyDtype ¶
FromNumpyDtype returns a Dtype given a string that matches Numpy's Dtype.
func (Dtype) FreeTypeVar ¶
func (dt Dtype) FreeTypeVar() hm.TypeVarSet
func (Dtype) NumpyDtype ¶
NumpyDtype returns the Numpy's Dtype equivalent. This is predominantly used in converting a Tensor to a Numpy ndarray, however, not all Dtypes are supported