IncompleteTypeNode: Cannot resolve type of Var()

Once constructing data like this:

[[[[-0.64189893]]

 [[-0.5155563 ]]

 [[-0.5729615 ]]

 ...

 [[-0.00979282]]

 [[-0.00870954]]

 [[ 0.00463101]]]

...

[[[ 1.4152465 ]]

 [[-0.77834904]]

 [[-0.8964073 ]]

 ...

 [[-0.00979282]]

 [[-0.00870954]]

 [[ 0.00463101]]]]

And the input shape is (1000, 1000, 1, 1). It is all fine to train the model using keras and output model in .h5 format. The model structure is as follows:

Conv2D->BN->Conv2D->BN->Flatten->Dense->BN->Dense->BN->Dense.

But when using tvm to compile this keras model.

model = keras.models.load_model(model_path)
shape_dict = {'input': (1, 1000, 1, 1)}
mod, params = relay.frontend.from_keras(model, shape_dict)
# compile the model
target = "llvm"
ctx = tvm.cpu(0)
with relay.build_config(opt_level=3):
....
)

I’m getting the error below:

TVMError: Check failed: checked_type.as<IncompleteTypeNode>() == nullptr: Cannot resolve type of Var(conv2d_1_input) at (nullptr)

I’m not sure if this is intended behaviour or not. And if this is intended behaviour, I’m curious what use case does it support. And how could I solve this problem?

Have you solve the problem?

Hi,
I don’t know if you are still working on this but I had a similar issue and resolved it by converting my keras model from sequential to functional. Hope this helps.
Pete

Hi Pete,

I have a similar issue and I don’t know how to resolve it. Would you mind explain in detail? How to convert Keras model from sequential to functional?

Thanks in advance.