Documentation
¶
Index ¶
- Variables
- func CurrDir() string
- func DTypeSize(dt DType) (retVal uint, err error)
- func ElementGoType(data interface{}) (retVal reflect.Type, err error)
- func Hello()
- func InstallLibtorch()
- 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)
- func Unzip(src, dest string) 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} )
var ( GotchCacheDir string TorchDir string IsCudaAvailable bool = false HomeDir string )
var ( GotchVersion string = "v0.3.4" TorchVersion string = "1.7.0" CudaVersion string = "10.1" )
Functions ¶
func CurrDir ¶ added in v0.3.4
func CurrDir() string
CurrDir returns absolute path of the file contains code calling this function.
func ElementGoType ¶
ElementGoType infers and returns Go type of element in given data
func InstallLibtorch ¶ added in v0.3.4
func InstallLibtorch()
func IsSupportedScalar ¶
IsSupportedScalar checks whether given SCALAR type is supported TODO: check input is a scalar.
func Unzip ¶ added in v0.3.4
Unzip unzips file Ref. https://stackoverflow.com/questions/20357223
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
|
|
|
basic
command
|
|
|
char-rnn
command
|
|
|
cifar
command
|
|
|
convert-model
command
|
|
|
debug-memory
command
|
|
|
jit
command
|
|
|
mnist
command
|
|
|
neural-style-transfer
command
|
|
|
pretrained-model
command
|
|
|
tensor-grad
command
|
|
|
tensor-io
command
|
|
|
transfer-learning
command
|
|
|
translation
command
|
|
|
yolo
command
|
|
|
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` |