-
Notifications
You must be signed in to change notification settings - Fork 3
/
type.go
38 lines (34 loc) · 1010 Bytes
/
type.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package pytorch
// #include "cbits/predictor.hpp"
import "C"
import "reflect"
// DType tensor scalar data type
type DType C.Torch_DataType
const (
UnknownType DType = C.Torch_Unknown
// Byte byte tensors (go type uint8)
Byte DType = C.Torch_Byte
// Char char tensor (go type int8)
Char DType = C.Torch_Char
// Int int tensor (go type int32)
Int DType = C.Torch_Int
// Long long tensor (go type int64)
Long DType = C.Torch_Long
// Float tensor (go type float32)
Float DType = C.Torch_Float
// Double tensor (go type float64)
Double DType = C.Torch_Double
)
var types = []struct {
typ reflect.Type
dataType C.Torch_DataType
}{
{reflect.TypeOf(uint8(0)), C.Torch_Byte},
{reflect.TypeOf(int8(0)), C.Torch_Char},
// {reflect.TypeOf(int16(0)), C.Torch_Short},
{reflect.TypeOf(int32(0)), C.Torch_Int},
{reflect.TypeOf(int64(0)), C.Torch_Long},
// {reflect.TypeOf(float16(0)), C.Torch_Half},
{reflect.TypeOf(float32(0)), C.Torch_Float},
{reflect.TypeOf(float64(0)), C.Torch_Double},
}