'Input shape mismatch: Input 'dense_input' has shape 1,5, but input data is of length 1
I'm trying to load an ONNX model in my C# project which I've trained using Python Keras. It gives me this error:
Unhandled Exception: System.InvalidOperationException: Input shape mismatch: Input 'dense_input' has shape 1,5, but input data is of length 1.
My program.cs file:
var context = new MLContext();
var data = context.Data.LoadFromEnumerable(new HeartInput[] { });
var inputColumns = new string[] { "dense_input" };
var outputColumns = new string[] { "dense_2" };
var pipeline = context.Transforms.ApplyOnnxModel(
outputColumnNames: outputColumns,
inputColumnNames: inputColumns,
modelFile: OnnxPath);
var model = pipeline.Fit(data);
HeartInput class:
public class HeartInput
{
[ColumnName("dense_input")]
public float DenseInput { get; set; }
}
When I check my ONNX model using Netron,

Is it because of the unk__ shape in my model? How to fix the error?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
