Documentation
¶
Index ¶
- Variables
- func DTypeSize(dt DType) (retVal uint, err error)
- func ElementGoType(data interface{}) (retVal reflect.Type, err error)
- func IsSupportedScalar(k reflect.Kind) bool
- func ToGoType(dtype DType) (retVal reflect.Type, err error)
- func TypeOf(dt DType, shape []int64) (retVal reflect.Type, err error)
- type CInt
- type Cuda
- type DType
- type DTypeDevice
- type Device
Constants ¶
This section is empty.
Variables ¶
var ( CPU Device = Device{Name: "CPU", Value: -1} CUDA Cuda = Cuda{Name: "CUDA", Value: 0} )
Functions ¶
func ElementGoType ¶
ElementGoType infers and returns Go type of element in given data
func IsSupportedScalar ¶
IsSupportedScalar checks whether given SCALAR type is supported TODO: check input is a scalar.
Types ¶
type Cuda ¶
type Cuda Device
func (Cuda) CudnnIsAvailable ¶
CudnnIsAvailable return true if cudnn support is available
func (Cuda) CudnnSetBenchmark ¶
CudnnSetBenchmark sets cudnn benchmark mode
When set cudnn will try to optimize the generators during the first network runs and then use the optimized architecture in the following runs. This can result in significant performance improvements.
func (Cuda) DeviceCount ¶
DeviceCount returns the number of GPU that can be used.
func (Cuda) IsAvailable ¶
CudnnIsAvailable returns true if cuda support is available
type DType ¶
DType represents different kind of element that a tensor can hold. It has an embedded `reflect.Type` for type reflection.
var ( Uint8 DType = DType{reflect.TypeOf(uint8(1))} // 0 Int8 DType = DType{reflect.TypeOf(int8(1))} // 1 Int16 DType = DType{reflect.TypeOf(int16(1))} // 2 Int DType = DType{reflect.TypeOf(int32(1))} // 3 Int64 DType = DType{reflect.TypeOf(int64(1))} // 4 // Half DType = DType{reflect.TypeOf(GoFloat16(1))} // 5 Float DType = DType{reflect.TypeOf(float32(1))} // 6 Double DType = DType{reflect.TypeOf(float64(1))} // 7 // ComplexHalf DType = DType{reflect.TypeOf(GoComplexHalf(1))} // 8 // ComplexFloat DType = DType{reflect.TypeOf(complex64(1))} // 9 // ComplexDouble DType = DType{reflect.TypeOf(complex128(1))} // 10 Bool DType = DType{reflect.TypeOf(true)} // 11 )
TODO: double check these Torch DType to Go type
func CInt2DType ¶
func DTypeFromData ¶
DTypeFromData infers returns equavalent DType from given data
func ElementDType ¶
ElementDType infers and returns its own tensor data type
type DTypeDevice ¶
var ( FloatCPU DTypeDevice = DTypeDevice{Float, CPU} DoubleCPU DTypeDevice = DTypeDevice{Double, CPU} Int64CPU DTypeDevice = DTypeDevice{Int64, CPU} FloatCUDA DTypeDevice = DTypeDevice{Float, CudaBuilder(0)} DoubleCUDA DTypeDevice = DTypeDevice{Double, CudaBuilder(0)} Int64CUDA DTypeDevice = DTypeDevice{Int64, CudaBuilder(0)} )
type Device ¶
func CudaBuilder ¶
func NewCuda ¶
func NewCuda() Device
NewCuda creates a cuda device (default) if available If will be panic if cuda is not available.
func (Device) CudaIfAvailable ¶
CudaIfAvailable returns a GPU device if available, else default to CPU
Directories
¶
Path | Synopsis |
---|---|
example
|
|
yolo/freetype
The freetype package provides a convenient API to draw text onto an image.
|
The freetype package provides a convenient API to draw text onto an image. |
NOTE: functions in this file would be automatically generated and named as `c-generated.go`
|
NOTE: functions in this file would be automatically generated and named as `c-generated.go` |