[relay] module.cc failing on test case


#1

I’m currently trying to get this simple line of code to work:

def merge_conv_test():
data = keras.layers.Input(shape=(32,32,3))
x = keras.layers.Conv2D(8, (3, 3), padding=“valid”)(data)
y = keras.layers.Conv2D(8, (3, 3), padding=“valid”)(data)
z = keras.layers.Conv2D(8, (3, 3), padding=“valid”)(data)
merge_funcs = [keras.layers.Add(),
keras.layers.Subtract(),
keras.layers.Multiply(),
keras.layers.Maximum()]#,
#keras.layers.Average(),
# keras.layers.Concatenate()]
for merge_func in merge_funcs:
if isinstance(merge_func, (keras.layers.merge.Subtract, keras.layers.merge.Dot)):
out = merge_func([x, y])
else:
out = merge_func([x, y, z])
out = keras.layers.Add()([x,y])
keras_model = keras.models.Model(data, out)
verify_keras_frontend(keras_model)

However, when I try to run this code, I end up with an issue stemming from here:

fn (%input_1: Tensor[(1, 32, 32, 3), float32], %v_param_1: Tensor[(1, 3, 3, 3), float32], %v_param_2:
Tensor[(1), float32], %v_param_3: Tensor[(1, 3, 3, 3), float32], %v_param_4: Tensor[(1), float32]) {
%0 = nn.conv2d(%input_1, %v_param_1, channels=1, kernel_size=[3, 3]);
%1 = nn.bias_add(%0, %v_param_2);
%2 = nn.conv2d(%input_1, %v_param_3, channels=1, kernel_size=[3, 3]);
%3 = nn.bias_add(%2, %v_param_4);
add(%1, %3)
} Funcs: {} Defs {}
Traceback (most recent call last):
File “test_keras.py”, line 226, in
merge_conv_test()
File “test_keras.py”, line 95, in merge_conv_test
verify_keras_frontend(keras_model)
File “test_keras.py”, line 31, in verify_keras_frontend
f,params = get_hcl_output(xs)
File “test_keras.py”, line 25, in get_hcl_output
return get_relay_model(keras_model, shape_dict, ‘keras’)
File “/home/pbclo/install/heterocl/frontend/python/frontend/relay_parser.py”, line 753, in get_relay_model
model, shape, frontend)
File “/home/pbclo/install/heterocl/frontend/python/frontend/relay_parser.py”, line 483, in relay_parser
module, params = relay_front.from_keras(keras_model, shape)
File “/home/pbclo/.local/lib/python3.7/site-packages/tvm-0.6.dev0-py3.7-linux-x86_64.egg/tvm/relay/frontend/keras.py”, line 812, in from_keras
return _module.Module.from_expr(func), params
File “/home/pbclo/.local/lib/python3.7/site-packages/tvm-0.6.dev0-py3.7-linux-x86_64.egg/tvm/relay/module.py”, line 234, in from_expr
return _module.Module_FromExpr(expr, funcs, defs)
File “/home/pbclo/.local/lib/python3.7/site-packages/tvm-0.6.dev0-py3.7-linux-x86_64.egg/tvm/_ffi/_ctypes/function.py”, line 210, in call
raise get_last_ffi_error()
File “/home/pbclo/.local/lib/python3.7/site-packages/tvm-0.6.dev0-py3.7-linux-x86_64.egg/tvm/_ffi/base.py”, line 296, in get_last_ffi_error
py_err_msg, err_type = c2pyerror(c_err_msg)
File “/home/pbclo/.local/lib/python3.7/site-packages/tvm-0.6.dev0-py3.7-linux-x86_64.egg/tvm/_ffi/base.py”, line 220, in c2pyerror
err_type = _find_error_type(arr[0])
IndexError: list index out of range

The code is functionally correct, but somewhere in the C API, it’s throwing an error. How do I fix this?