Skip to content
This repository has been archived by the owner on May 31, 2024. It is now read-only.

[BUG] An initializer can be declared without previous reference in input/output/value #108

Closed
owulveryck opened this issue Aug 14, 2019 · 0 comments

Comments

@owulveryck
Copy link
Owner

owulveryck commented Aug 14, 2019

Trying to execute the yolo v3 model raise this error:

model_zoo_executor git:(master) ✗  MODELDIR=models/yolov3 go test -failfast | more
--- FAIL: TestModel (1.37s)
    --- FAIL: TestModel/Unmarshal (1.37s)
        main_test.go:56: invalid model: initializer has not been defined in input, output or value
FAIL
exit status 1
FAIL    github.com/owulveryck/onnx-go/examples/model_zoo_executor       2.306s

This is triggered by

onnx-go/decoder.go

Lines 137 to 145 in 1681b26

for _, tensorProto := range model.Graph.GetInitializer() {
name := tensorProto.GetName()
if name == "" {
return errors.New("initializer should have a name")
}
n, ok := m.dbByName[name]
if !ok {
return errors.New("invalid model: initializer has not been defined in input, output or value")
}

This error is triggered if the initializer (referenced by its name) has not been defined previously.

However, a recent change in the IR doc of onnx now specifies:

When an initializer has the same name as a graph input, it specifies a default value for that input. When an initializer has a name different from all graph inputs, it specifies a constant value.

Hence, the onnx-go parser must be fixed to create a new node in the graph if the initializer has not been defined before.

Note: by now, onnx-go only handles two types of nodes:

  • Operator
  • tensor
    We may use tensor to represent the initializer, but it will silently discard the fact that this node is constant. I propose to use the YAGNI principle and postpone the decision to mark the node as a constant.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant