Generate settings for nn.Linear(1, 1)
Vid201 opened this issue · 1 comments
Describe the bug
Trying to generate settings for simple linear layer:
model = nn.Linear(1, 1)
There is an error about dimension mismatch. I think this line is problematic: https://github.com/zkonduit/ezkl/blob/main/src/graph/model.rs#L703
Model object has correct outputs for op Const
till this line, after that line the output dims are "lost",
Model
Trace output when loading onnx model.
*] [0s, ezkl::graph::model] - set batch_size to 1
[T] [0s, ezkl::graph::node] - Create Node { id: 0, name: "input", inputs: [], op: TypedSource { fact: 1,1,F32 }, outputs: [1,1,F32 >2/0] }
[T] [0s, ezkl::graph::node] - Create op TypedSource { fact: 1,1,F32 }
[D] [0s, ezkl::graph::utilities] - Loading node: Node { id: 0, name: "input", inputs: [], op: TypedSource { fact: 1,1,F32 }, outputs: [1,1,F32 >2/0] }
[T] [0s, ezkl::graph::node] - Create Node { id: 1, name: "weight.0", inputs: [], op: Const(,F32 0.60927737), outputs: [,F32 0.60927737 >2/1] }
[T] [0s, ezkl::graph::node] - Create op Const(,F32 0.60927737)
[D] [0s, ezkl::graph::utilities] - Loading node: Node { id: 1, name: "weight.0", inputs: [], op: Const(,F32 0.60927737), outputs: [,F32 0.60927737 >2/1] }
[T] [0s, ezkl::graph::node] - Create Node { id: 2, name: "/Gemm.ab", inputs: [0/0>, 1/0>], op: EinSum mk,->mn (F32), outputs: [1,1,F32 >4/0] }
[T] [0s, ezkl::graph::node] - Create op EinSum mk,->mn (F32)
[D] [0s, ezkl::graph::utilities] - Loading node: Node { id: 2, name: "/Gemm.ab", inputs: [0/0>, 1/0>], op: EinSum mk,->mn (F32), outputs: [1,1,F32 >4/0] }
[T] [0s, ezkl::graph::node] - Create Node { id: 3, name: "/Gemm.beta_c", inputs: [], op: Const(1,1,F32 -0.27064884), outputs: [1,1,F32 -0.27064884 >4/1] }
[T] [0s, ezkl::graph::node] - Create op Const(1,1,F32 -0.27064884)
[D] [0s, ezkl::graph::utilities] - Loading node: Node { id: 3, name: "/Gemm.beta_c", inputs: [], op: Const(1,1,F32 -0.27064884), outputs: [1,1,F32 -0.27064884 >4/1] }
[T] [0s, ezkl::graph::node] - Create Node { id: 4, name: "/Gemm", inputs: [2/0>, 3/0>], op: TypedBinOp(Add), outputs: [1,1,F32 ] }
[T] [0s, ezkl::graph::node] - Create op TypedBinOp(Add)
[D] [0s, ezkl::graph::utilities] - Loading node: Node { id: 4, name: "/Gemm", inputs: [2/0>, 3/0>], op: TypedBinOp(Add), outputs: [1,1,F32 ] }
Output
[] [0s, ezkl::graph::model] - model has 1 instances
[] [0s, ezkl::graph::model] - calculating num of constraints using dummy model layout...
[D] [0s, ezkl::graph::model] - laying out 0: Input, offset:0, total_constants: 0
[D] [0s, ezkl::graph::model] - dims: [[1, 1]]
[D] [0s, ezkl::graph::model] - input_dims: [[1, 1]]
[D] [0s, ezkl::graph::model] - ------------ output node 0: "Tensor { inner: [0], dims: [1, 1], scale: None, visibility: None }"
[D] [0s, ezkl::graph::model] - laying out 1: CONST (scale=7), offset:1, total_constants: 0
[D] [0s, ezkl::graph::model] - dims: [[1]]
[D] [0s, ezkl::graph::model] - input_dims: []
[D] [0s, ezkl::graph::model] - ------------ output node 1: "Tensor { inner: [], dims: [0], scale: None, visibility: None }"
[D] [0s, ezkl::graph::model] - laying out 2: REBASED (div=128.0) (EINSUM mk,->mn), offset:1, total_constants: 0
[D] [0s, ezkl::graph::model] - dims: [[1, 1]]
[D] [0s, ezkl::graph::model] - input_dims: [[1, 1], [0]]
[E] [0s, ezkl::graph::model] - dimension mismatch in tensor op: einsum
@Vid201 thanks for this -- will be issuing a patch soon :)