Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

panic: negative dimension size does not make sense #193

Open
orestonce opened this issue May 27, 2022 · 0 comments
Open

panic: negative dimension size does not make sense #193

orestonce opened this issue May 27, 2022 · 0 comments

Comments

@orestonce
Copy link

package main

import (
	_ "embed"
	"fmt"
	"github.com/owulveryck/onnx-go"
	"github.com/owulveryck/onnx-go/backend/x/gorgonnx"
)

//go:embed model/ch_ppocr_mobile_v2.0_cls_infer.onnx
var gModelData []byte

func main() {
	// Create a backend receiver
	backend := gorgonnx.NewGraph()
	//backend := simple.NewSimpleGraph()
	// Create a model and set the execution backend
	model := onnx.NewModel(backend)

	// read the onnx model
	// Decode it into the model
	err := model.UnmarshalBinary(gModelData)
	if err != nil {
		panic(err)
	}
	fmt.Println(model.Input, model.Output)
}
  • output:
panic: negative dimension size does not make sense

goroutine 1 [running]:
gorgonia.org/tensor.Shape.CalcStrides({0xc0003f3660, 0x4, 0xc0003f3640})
	C:/local/gopath/pkg/mod/gorgonia.org/[email protected]/shape.go:45 +0xa7
gorgonia.org/tensor.(*AP).calcStrides(0x4)
	C:/local/gopath/pkg/mod/gorgonia.org/[email protected]/ap.go:348 +0x4e
gorgonia.org/tensor.(*AP).SetShape(0xc000489b00, {0xc0003f3640, 0x4, 0x120})
	C:/local/gopath/pkg/mod/gorgonia.org/[email protected]/ap.go:83 +0x1b4
gorgonia.org/tensor.(*Dense).setShape(0xc000489b00, {0xc0003f3640, 0xc000111c78, 0x3eda07})
	C:/local/gopath/pkg/mod/gorgonia.org/[email protected]/dense.go:264 +0x27
gorgonia.org/tensor.WithShape.func1({0xb3ec10, 0xc000489b00})
	C:/local/gopath/pkg/mod/gorgonia.org/[email protected]/consopt.go:83 +0xbe
gorgonia.org/tensor.New({0xc000475ac0, 0x2, 0x4})
	C:/local/gopath/pkg/mod/gorgonia.org/[email protected]/tensor.go:91 +0x4d
github.com/owulveryck/onnx-go.(*Model).processValue(0xc000111f28, 0xc0000a7040)
	C:/local/gopath/pkg/mod/github.com/owulveryck/[email protected]/decoder.go:81 +0x345
github.com/owulveryck/onnx-go.(*Model).applyModelProtoGraph(0xc000111f28, 0xc0000a8000)
	C:/local/gopath/pkg/mod/github.com/owulveryck/[email protected]/decoder.go:126 +0x145
github.com/owulveryck/onnx-go.(*Model).decodeProto(0xebd200, 0x8e8d3)
	C:/local/gopath/pkg/mod/github.com/owulveryck/[email protected]/decoder.go:112 +0x18a
github.com/owulveryck/onnx-go.(*Model).UnmarshalBinary(0x2b51e3ab7d0, {0xebd200, 0x8e8d3, 0x8e8d3})
	C:/local/gopath/pkg/mod/github.com/owulveryck/[email protected]/decoder.go:38 +0x75
main.main()
	D:/go-projects/test2/main.go:22 +0x211
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant