Giter Club home page Giter Club logo

Comments (5)

owulveryck avatar owulveryck commented on June 19, 2024 1

The plan is:

  • to write a (red) test in onnx-go based on the structure in the comment
  • make the test pass by modifying the onnx decoder
  • write a similar test in gorgonnx
  • make the test pass.

from onnx-go.

owulveryck avatar owulveryck commented on June 19, 2024

Hello,
Many thanks for submitting this issue and for your investigation.
I will have a closer look at the bug as soon as.possible.
First step is to write a simple test to reproduce this.
It will ease the analysis and the debugging process.

from onnx-go.

bezineb5 avatar bezineb5 commented on June 19, 2024

Hi,
Thanks for this. I attached an example model and source code:
example_mul.zip
The graph just squares the input:
image

Expected output (with input = 2.0): 4.0
Actual output:
bad arity for operation (have 1, want 2)

from onnx-go.

owulveryck avatar owulveryck commented on June 19, 2024

Thanks a lot.
I've created a branch for tracking this issue.

I think the solution would be to play with the self edge (cf godoc).

I've dumped the content of your onnx file for info.
I will work on it tomorrow evening CEST, but from what I see, the solution would be to add a self edge when two inputs are listed and equal.

The main problem is that we are losing the order of inputs as the self-edge must have a fixed weight within the current implementation.

pb.ModelProto{
        IrVersion: 5,
        OpsetImport: []*pb.OperatorSetIdProto{
                &pb.OperatorSetIdProto{
                        Domain:  "",
                        Version: 7,
                },
        },
        ProducerName:    "tf2onnx",
        ProducerVersion: "1.5.3",
        Domain:          "",
        ModelVersion:    0,
        DocString:       "",
        Graph: &pb.GraphProto{
                Node: []*pb.NodeProto{
                        &pb.NodeProto{
                                Input: []string{
                                        "x:0",
                                        "x:0",
                                },
                                Output: []string{
                                        "mul:0",
                                },
                                Name:      "mul",
                                OpType:    "Mul",
                                Domain:    "",
                                Attribute: nil,
                                DocString: "",
                        },
                },
                Name:        "tf2onnx",
                Initializer: nil,
                DocString:   "converted from ./model_nowind_test/export/",
                Input: []*pb.ValueInfoProto{
                        &pb.ValueInfoProto{
                                Name: "x:0",
                                Type: &pb.TypeProto{
                                        Value: &pb.TypeProto_TensorType{
                                                TensorType: &pb.TypeProto_Tensor{
                                                        ElemType: 1,
                                                        Shape: &pb.TensorShapeProto{
                                                                Dim: []*pb.TensorShapeProto_Dimension{
                                                                        &pb.TensorShapeProto_Dimension{
                                                                                Value: &pb.TensorShapeProto_Dimension_DimValue{
                                                                                        DimValue: 1,
                                                                                },
                                                                                Denotation: "",
                                                                        },
                                                                },
                                                        },
                                                },
                                        },
                                        Denotation: "",
                                },
                                DocString: "",
                        },
                },
                Output: []*pb.ValueInfoProto{
                        &pb.ValueInfoProto{
                                Name: "mul:0",
                                Type: &pb.TypeProto{
                                        Value: &pb.TypeProto_TensorType{
                                                TensorType: &pb.TypeProto_Tensor{
                                                        ElemType: 1,
                                                        Shape: &pb.TensorShapeProto{
                                                                Dim: []*pb.TensorShapeProto_Dimension{
                                                                        &pb.TensorShapeProto_Dimension{
                                                                                Value: &pb.TensorShapeProto_Dimension_DimValue{
                                                                                        DimValue: 1,
                                                                                },
                                                                                Denotation: "",
                                                                        },
                                                                },
                                                        },
                                                },
                                        },
                                        Denotation: "",
                                },
                                DocString: "",
                        },
                },
                ValueInfo: nil,
        },
        MetadataProps: nil,
}

from onnx-go.

owulveryck avatar owulveryck commented on June 19, 2024

some update about this issue.
The branch has the tests which is already something. At first, I thought it would be easy to implement the self-link, at least in the main graph (in the Model structure).
The problem is that the simple graph implementation we use as a receiver for gorgonnx does not handle self links.

type Graph struct {
g *simple.WeightedDirectedGraph

From the godoc of gonum:

SetWeightedEdge adds a weighted edge from one node to another. If the nodes do not exist, they are added and are set to the nodes of the edge otherwise. It will panic if the IDs of the e.From and e.To are equal.

Therefore using a self-link is more difficult than expected.
(On top of that, walking the graph in gorgonnx would not be trivial.)

Therefore, it may be safer to think about another implementation to solve this issue.
By now, I am out-of-idea, but I am sure a solution exists. We just need to figure it out.

from onnx-go.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.