-
Notifications
You must be signed in to change notification settings - Fork 66
Expand file tree
/
Copy pathstatus.go
More file actions
65 lines (57 loc) · 2.48 KB
/
Copy pathstatus.go
File metadata and controls
65 lines (57 loc) · 2.48 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package cudnn
// #include <cudnn.h>
import "C"
type Status = cudnnStatus
type cudnnStatus int
func (err cudnnStatus) Error() string { return err.String() }
func (err cudnnStatus) String() string { return resString[err] }
func (err cudnnStatus) C() C.cudnnStatus_t { return C.cudnnStatus_t(err) }
func result(x C.cudnnStatus_t) error {
err := cudnnStatus(x)
if err == Success {
return nil
}
if err > RuntimeFpOverflow {
return NotSupported
}
return err
}
const (
Success cudnnStatus = C.CUDNN_STATUS_SUCCESS
NotInitialized cudnnStatus = C.CUDNN_STATUS_NOT_INITIALIZED
AllocFailed cudnnStatus = C.CUDNN_STATUS_ALLOC_FAILED
BadParam cudnnStatus = C.CUDNN_STATUS_BAD_PARAM
InternalError cudnnStatus = C.CUDNN_STATUS_INTERNAL_ERROR
InvalidValue cudnnStatus = C.CUDNN_STATUS_INVALID_VALUE
ArchMismatch cudnnStatus = C.CUDNN_STATUS_ARCH_MISMATCH
MappingError cudnnStatus = C.CUDNN_STATUS_MAPPING_ERROR
ExecutionFailed cudnnStatus = C.CUDNN_STATUS_EXECUTION_FAILED
NotSupported cudnnStatus = C.CUDNN_STATUS_NOT_SUPPORTED
LicenseError cudnnStatus = C.CUDNN_STATUS_LICENSE_ERROR
RuntimePrerequisiteMissing cudnnStatus = C.CUDNN_STATUS_RUNTIME_PREREQUISITE_MISSING
RuntimeInProgress cudnnStatus = C.CUDNN_STATUS_RUNTIME_IN_PROGRESS
RuntimeFpOverflow cudnnStatus = C.CUDNN_STATUS_RUNTIME_FP_OVERFLOW
)
var resString = map[cudnnStatus]string{
Success: "Success",
NotInitialized: "NotInitialized",
AllocFailed: "AllocFailed",
BadParam: "BadParam",
InternalError: "cuDNN InternalError",
InvalidValue: "cuDNN InvalidValue",
ArchMismatch: "ArchMismatch",
MappingError: "MappingError",
ExecutionFailed: "ExecutionFailed",
NotSupported: "NotSupported",
LicenseError: "LicenseError",
RuntimePrerequisiteMissing: "RuntimePrerequisiteMissing",
RuntimeInProgress: "RuntimeInProgress",
RuntimeFpOverflow: "RuntimeFpOverflow",
}
const (
dtypeMismatch3 = "Dtype Mismatch. These three should match %v, %v and %v."
dtypeMismatch2 = "Dtype Mismatch. Expected %v or %v. Got %v instead."
shapeMismatch3 = "Shape Mismatch. These three should match %v, %v and %v"
memoryError3 = "Memory Error. A: %p B: %p C: %p"
nyi = "Not yet implemented. %v %v"
)