Are variably shaped keras models supported?

I’ve got a keras model here with unknown/unspecified shapes like

(None, None, None, 3)

for a Conv2D layer.

However, this does not work with TVM relay due to the following error:

  File "yolo.py", line 92, in to_onnx_tvm
    func, params = relay.frontend.from_keras(self.yolo_model, shape_dict)
  File "/home/martin/.local/lib/python3.6/site-packages/tvm-0.6.dev0-py3.6-linux-x86_64.egg/tvm/relay/frontend/keras.py", line 723, in from_keras
    keras_op_to_relay(inexpr, keras_layer, keras_layer.name + ':' + str(node_idx), etab)
  File "/home/martin/.local/lib/python3.6/site-packages/tvm-0.6.dev0-py3.6-linux-x86_64.egg/tvm/relay/frontend/keras.py", line 647, in keras_op_to_relay
    outs = _convert_map[op_name](inexpr, keras_layer, etab)
  File "/home/martin/.local/lib/python3.6/site-packages/tvm-0.6.dev0-py3.6-linux-x86_64.egg/tvm/relay/frontend/keras.py", line 214, in _convert_convolution
    pad_t, pad_b = _get_pad_pair(in_h, dilated_kernel_h, stride_h)
  File "/home/martin/.local/lib/python3.6/site-packages/tvm-0.6.dev0-py3.6-linux-x86_64.egg/tvm/relay/frontend/keras.py", line 23, in _get_pad_pair
    out1d = (input1d + stride1d - 1) // stride1d
TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'

I’ve seen other questions here regarding this topic like:


It is a bit unclear to me, whether I’m doing something wrong or if this a bug. If it’s clear for you, that this cannot work, would it be possible to intentionally raise an error in such a case?

Dynamic shape support is in progress, for both compilation and runtime. This error is related to keras converter, and it looks like only supporting static shape.

Awesome, looking forward to it!