gmalivenko / onnx2keras

Convert ONNX model graph to Keras model format.
MIT License
193 stars 115 forks source link

NotImplementedError: Can't modify this type of data #94

Open sahooora opened 3 years ago

sahooora commented 3 years ago

Below there is the snippet of code I use for import and conversion:

import onnx
from onnx2keras import onnx_to_keras

onnx_model = onxx.load('UCI_simplification_1.onnx')
k_model = onnx_to_keras(onnx_model, ['input_1'])

When I run I get:

INFO:onnx2keras:Converter is called.
DEBUG:onnx2keras:List input shapes:
DEBUG:onnx2keras:None
DEBUG:onnx2keras:List inputs:
DEBUG:onnx2keras:Input 0 -> input_1.
DEBUG:onnx2keras:List outputs:
DEBUG:onnx2keras:Output 0 -> dense.
DEBUG:onnx2keras:Gathering weights to dictionary.
DEBUG:onnx2keras:Found weight dense/kernel:0 with shape (128, 6).
DEBUG:onnx2keras:Found weight dense/bias:0 with shape (6,).
DEBUG:onnx2keras:Found weight lstm_W with shape (1, 512, 3).
DEBUG:onnx2keras:Found weight lstm_R with shape (1, 512, 128).
DEBUG:onnx2keras:Found weight lstm_B with shape (1, 1024).
DEBUG:onnx2keras:Found input input_1 with shape [128, 3]
DEBUG:onnx2keras:######
DEBUG:onnx2keras:...
DEBUG:onnx2keras:Converting ONNX operation
DEBUG:onnx2keras:type: Transpose
DEBUG:onnx2keras:node_name: lstm_X
DEBUG:onnx2keras:node_params: {'perm': [1, 0, 2], 'change_ordering': False, 'name_policy': None}
DEBUG:onnx2keras:...
DEBUG:onnx2keras:Check if all inputs are available:
DEBUG:onnx2keras:Check input 0 (name input_1).
DEBUG:onnx2keras:... found all, continue
WARNING:onnx2keras:transpose:Can't permute batch dimension. Result may be wrong.
Traceback (most recent call last):
  File "digits.py", line 31, in <module>
    model_k = onnx_to_keras(onnx_model, ['input_1'])
  File "/usr/local/lib/python3.8/dist-packages/onnx2keras/converter.py", line 175, in onnx_to_keras
    AVAILABLE_CONVERTERS[node_type](
  File "/usr/local/lib/python3.8/dist-packages/onnx2keras/reshape_layers.py", line 27, in convert_transpose
    raise NotImplementedError('Can\'t modify this type of data')
NotImplementedError: Can't modify this type of data

Thanks in advance

Andredance commented 3 years ago

Hi. Please, share your ONNX model

sahooora commented 3 years ago

Hi. Please, share your ONNX model

Here it is.

UCI.tar.gz

Thanks in advance

Andredance commented 3 years ago

I checked your model and got some:

Sorry for answering for a long time. Maybe in the future, we gonna support LSTM but I can say exactly when. Also, you can try to make it work by yourself if you want. Good luck!