-
-
Notifications
You must be signed in to change notification settings - Fork 69
WeightedDirectedGraph doesn't support multiple edges from one node to another #120
Comments
Hello, |
Hi, Expected output (with input = 2.0): 4.0 |
Thanks a lot. I think the solution would be to play with the I've dumped the content of your onnx file for info. 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,
} |
The plan is:
|
some update about this issue. onnx-go/backend/x/gorgonnx/graph.go Lines 17 to 18 in 7c482d5
From the godoc of gonum:
Therefore using a self-link is more difficult than expected. Therefore, it may be safer to think about another implementation to solve this issue. |
Context
I have a graph which contains the following "Sub" operation:
=> It subracts a value from itself
(why is it like that? It's the conversion of Tensorflow's Maximum/Minimum in ONNX 7 which is translated like that in order to support broadcast - however I would expect the behaviour to be the same on a square X*X operation)
Problem
When running the model, I get the following error:
bad arity for operation (have 1, want 2)
Cause
When looking at the implementation of WeightedDirectedGraph.SetWeightedEdge, it seems that it's not possible to have 2 identical edges from one node to another.
Solution
It's not clear how to fix that without big changes. However, it means that it can happen in other cases and prevent correct execution of many ONNX models.
Any idea on a fix?
The text was updated successfully, but these errors were encountered: