-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy patherrors.go
More file actions
32 lines (25 loc) · 765 Bytes
/
errors.go
File metadata and controls
32 lines (25 loc) · 765 Bytes
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
package gonnx
import (
"errors"
"fmt"
"github.com/advancedclimatesystems/gonnx/onnx"
)
var errModel = errors.New("gonnx model error")
type InvalidShapeError struct {
expected onnx.Shape
actual []int
}
func (i InvalidShapeError) Error() string {
return fmt.Sprintf("invalid shape error expected: %v actual %v", i.expected, i.actual)
}
func ErrInvalidShape(expected onnx.Shape, actual []int) error {
return InvalidShapeError{
expected: expected,
actual: actual,
}
}
// ErrModel is used for when an error ocured during setup of running onnx models.
// The user can specify a formatted message using the standard formatting rules.
func ErrModel(format string, a ...any) error {
return fmt.Errorf("%w: %s", errModel, fmt.Sprintf(format, a...))
}