TensorFlow: Improve panic log messages #1270
This commit is contained in:
parent
cd0f201ef4
commit
daab99015a
1 changed files with 2 additions and 2 deletions
|
@ -62,7 +62,7 @@ func (t *TensorFlow) File(filename string) (result Labels, err error) {
|
||||||
func (t *TensorFlow) Labels(img []byte) (result Labels, err error) {
|
func (t *TensorFlow) Labels(img []byte) (result Labels, err error) {
|
||||||
defer func() {
|
defer func() {
|
||||||
if r := recover(); r != nil {
|
if r := recover(); r != nil {
|
||||||
err = fmt.Errorf("classify: %s (panic)\nstack: %s", r, debug.Stack())
|
err = fmt.Errorf("classify: %s (inference panic)\nstack: %s", r, debug.Stack())
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ func (t *TensorFlow) Labels(img []byte) (result Labels, err error) {
|
||||||
tensor, err := t.createTensor(img, "jpeg")
|
tensor, err := t.createTensor(img, "jpeg")
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("classify: %s", err)
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run inference.
|
// Run inference.
|
||||||
|
|
Loading…
Reference in a new issue