I tried convert tf.keras model to cntk, but this does not work for me.
I used MMdnn: mmconvert -sf keras -iw genre_predictor.krs -df cntk -om genre_predictor.dnn
But he outputs this message:
TypeError: 'InputLayer' object is not iterable
I also try to convert keras to onnx, but i have no idea how i can run onnx model with negative dimension(at the input layer keras model have shape = (-1, 25000, 1), but onnxruntime in c# can't work with -1 dimension)
With this code:
var sess = new InferenceSession("genre_predictor.onnx");
var inputsDimensions = sess.InputMetadata.Values.First(); // int {-1, 25000, 1}
Tensor<float> t1 = new DenseTensor<float>(new float[25000], new int[] {1, 25000, 1});
var inputs = new List<NamedOnnxValue>()
{
NamedOnnxValue.CreateFromTensor<float>("first", t1)
};
sess.Run(inputs);
using (var outputs = sess.Run(inputs))
{
Console.WriteLine(outputs);
}
I have this exception:
Unhandled exception. Microsoft.ML.OnnxRuntime.OnnxRuntimeException: [ErrorCode:InvalidArgument] Invalid Feed Input Name:first
Microsoft.CNTK package also can't work with negative dimension.
With this code:
var device = DeviceDescriptor.CPUDevice;
Function.Load("genre_predictor.onnx", device, ModelFormat.ONNX);
I have this exception:
About to throw exception 'ConvertAxisToCNTKCppApi cannot convert index < 0 to axis' Unhandled exception. System.ApplicationException: ConvertAxisToCNTKCppApi cannot convert index < 0 to axis
I have no idea what I can do with this to run the keras model binary via .net. Pls help)
I tried convert tf.keras model to cntk, but this does not work for me. I used MMdnn:
mmconvert -sf keras -iw genre_predictor.krs -df cntk -om genre_predictor.dnn
But he outputs this message:TypeError: 'InputLayer' object is not iterable
I also try to convert keras to onnx, but i have no idea how i can run onnx model with negative dimension(at the input layer keras model have shape = (-1, 25000, 1), but onnxruntime in c# can't work with -1 dimension) With this code:
I have this exception:
Unhandled exception. Microsoft.ML.OnnxRuntime.OnnxRuntimeException: [ErrorCode:InvalidArgument] Invalid Feed Input Name:first
Microsoft.CNTK package also can't work with negative dimension. With this code:
I have this exception:
About to throw exception 'ConvertAxisToCNTKCppApi cannot convert index < 0 to axis' Unhandled exception. System.ApplicationException: ConvertAxisToCNTKCppApi cannot convert index < 0 to axis
I have no idea what I can do with this to run the keras model binary via .net. Pls help)