-
-
Notifications
You must be signed in to change notification settings - Fork 82
Description
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/tensor@v0.9.3/defaultengine.go:22 +0xec
gorgonia.org/tensor.(*Dense).makeArray(0xc00030b8c0, 0x0)
/home/anna/ml-hdd/go/pkg/mod/gorgonia.org/tensor@v0.9.3/dense.go:87 +0xe2
gorgonia.org/tensor.(*Dense).fix(0xc00030b8c0)
/home/anna/ml-hdd/go/pkg/mod/gorgonia.org/tensor@v0.9.3/dense.go:292 +0x1c5
gorgonia.org/tensor.New({0xc0001b03a0, 0x3, 0x1?})
/home/anna/ml-hdd/go/pkg/mod/gorgonia.org/tensor@v0.9.3/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/onnx-go@v0.5.0/internal/onnx/ir/tensor.go:51 +0x5e5
github.com/owulveryck/onnx-go.toOperationAttribute(0xc00019ba00)
/home/anna/ml-hdd/go/pkg/mod/github.com/owulveryck/onnx-go@v0.5.0/attributes.go:30 +0x109
github.com/owulveryck/onnx-go.toOperationAttributes({0xc0000126c0, 0x1, 0xc00031fad0?})
/home/anna/ml-hdd/go/pkg/mod/github.com/owulveryck/onnx-go@v0.5.0/attributes.go:10 +0x6c
github.com/owulveryck/onnx-go.(*Model).applyModelProtoGraphNodeOperations(0xc00010fed0, 0xc0119d05a0?)
/home/anna/ml-hdd/go/pkg/mod/github.com/owulveryck/onnx-go@v0.5.0/decoder.go:235 +0x10d
github.com/owulveryck/onnx-go.(*Model).applyModelProtoGraph(0xc00010fed0, 0xc0000ae000)
/home/anna/ml-hdd/go/pkg/mod/github.com/owulveryck/onnx-go@v0.5.0/decoder.go:149 +0x299
github.com/owulveryck/onnx-go.(*Model).decodeProto(0xc000200000?, 0x8b60ff7?)
/home/anna/ml-hdd/go/pkg/mod/github.com/owulveryck/onnx-go@v0.5.0/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/onnx-go@v0.5.0/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?