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

the Error during UnmarshalBinary(b) #209

Open
annatelegina opened this issue Jul 13, 2023 · 0 comments
Open

the Error during UnmarshalBinary(b) #209

annatelegina opened this issue Jul 13, 2023 · 0 comments

Comments

@annatelegina
Copy link

Hello everyone! I have the following problem during testing yolo model.

func Example_gorgonia() {

    backend := gorgonnx.NewGraph()
    model := onnx.NewModel(backend)

    b, err := ioutil.ReadFile("last_model.onnx")
    if err != nil {
            log.Fatal(err)
    }

    err = model.UnmarshalBinary(b)
    if err != nil {
            log.Fatal(err)
    }
    tensor := tensor.New(tensor.WithShape(1, 3, 640, 640), tensor.Of(tensor.Float32))
    model.SetInput(0, tensor)
    err = backend.Run()
    if err != nil {
            log.Fatal(err)
    }
    output, _ := model.GetOutputTensors()
    fmt.Println(output[0])
}

func main() {
    Example_gorgonia()
}

The output is:
panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
gorgonia.org/tensor.StdEng.makeArray({{}}, 0xc00030b8f8, {{0xb52d20?, 0xa14440?}}, 0x0)
/home/anna/ml-hdd/go/pkg/mod/gorgonia.org/[email protected]/defaultengine.go:22 +0xec
gorgonia.org/tensor.(*Dense).makeArray(0xc00030b8c0, 0x0)
/home/anna/ml-hdd/go/pkg/mod/gorgonia.org/[email protected]/dense.go:87 +0xe2
gorgonia.org/tensor.(*Dense).fix(0xc00030b8c0)
/home/anna/ml-hdd/go/pkg/mod/gorgonia.org/[email protected]/dense.go:292 +0x1c5
gorgonia.org/tensor.New({0xc0001b03a0, 0x3, 0x1?})
/home/anna/ml-hdd/go/pkg/mod/gorgonia.org/[email protected]/tensor.go:93 +0xb8
github.com/owulveryck/onnx-go/internal/onnx/ir.(*TensorProto).Tensor(0xc0000ac240)
/home/anna/ml-hdd/go/pkg/mod/github.com/owulveryck/[email protected]/internal/onnx/ir/tensor.go:51 +0x5e5
github.com/owulveryck/onnx-go.toOperationAttribute(0xc00019ba00)
/home/anna/ml-hdd/go/pkg/mod/github.com/owulveryck/[email protected]/attributes.go:30 +0x109
github.com/owulveryck/onnx-go.toOperationAttributes({0xc0000126c0, 0x1, 0xc00031fad0?})
/home/anna/ml-hdd/go/pkg/mod/github.com/owulveryck/[email protected]/attributes.go:10 +0x6c
github.com/owulveryck/onnx-go.(*Model).applyModelProtoGraphNodeOperations(0xc00010fed0, 0xc0119d05a0?)
/home/anna/ml-hdd/go/pkg/mod/github.com/owulveryck/[email protected]/decoder.go:235 +0x10d
github.com/owulveryck/onnx-go.(*Model).applyModelProtoGraph(0xc00010fed0, 0xc0000ae000)
/home/anna/ml-hdd/go/pkg/mod/github.com/owulveryck/[email protected]/decoder.go:149 +0x299
github.com/owulveryck/onnx-go.(*Model).decodeProto(0xc000200000?, 0x8b60ff7?)
/home/anna/ml-hdd/go/pkg/mod/github.com/owulveryck/[email protected]/decoder.go:112 +0x105
github.com/owulveryck/onnx-go.(*Model).UnmarshalBinary(0xaa2ff1?, {0xc000200000, 0x8b60ff7, 0x8b60ff8})
/home/anna/ml-hdd/go/pkg/mod/github.com/owulveryck/[email protected]/decoder.go:38 +0x75
main.Example_gorgonia()
/home/anna/ml-hdd/go/onnx/main.go:26 +0x29b
main.main()
/home/anna/ml-hdd/go/onnx/main.go:44 +0x1d
exit status 2

What should I do in this situation? Who has already tackled with this problem?

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