-
Notifications
You must be signed in to change notification settings - Fork 4
/
config.go
51 lines (43 loc) · 1.28 KB
/
config.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
39
40
41
42
43
44
45
46
47
48
49
50
51
package menoh
// Config is setup information to build Menoh model.
type Config struct {
ONNXModelPath string // path of ONNX file
Backend TypeBackend // backend type, like menoh.TypeMKLDNN
BackendConfig string // backend configuration
Inputs []InputConfig // list of input configuration
Outputs []OutputConfig // list of output configuration
}
// InputConfig is input variable information to pass to the model.
type InputConfig struct {
Name string // layer name
Dtype TypeDtype // data type
Dims []int32 // list of dimension size
}
// OutputConfig is output variable information to get from the model.
type OutputConfig struct {
Name string // layer name
Dtype TypeDtype // data type
FromInternal bool // if the output comes from operator variable such as weight, set true
}
// TypeDtype is a type of data.
type TypeDtype int
const (
typeUnknownDtype TypeDtype = iota
// TypeFloat is a TypeDtype of Float.
TypeFloat
)
// TypeBackend is a type of backend, like MKL-DNN.
type TypeBackend int
const (
typeUnknownBackend TypeBackend = iota
// TypeMKLDNN is a TypeBackend of MKL-DNN
TypeMKLDNN
)
func (t TypeBackend) String() string {
switch t {
case TypeMKLDNN:
return "mkldnn"
default:
return "unknown"
}
}