-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
73 changed files
with
1,084 additions
and
542 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,32 @@ | ||
package gonnx | ||
|
||
// InvalidShapeError is used when the shape of an input tensor does not match the expectation. | ||
const InvalidShapeError = "input shape does not match for %v: expected %v but got %v" | ||
import ( | ||
"errors" | ||
"fmt" | ||
|
||
// SetOutputTensorsError is used when the output of an operation could not be set. | ||
const SetOutputTensorsError = "could not set output tensors, expected %v tensors but got %v" | ||
"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...)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.