Cannot allocate memory symbolic tensor shape for tf.sparse.segment_sum


I try to convert tf.sparse.segment_sum with tvm’s relay function. But after import the graph, it report error when doing the relay build: Check failed: (pval != nullptr) is false: Cannot allocate memory symbolic tensor shape [?, ?]

I already specify the input with detailed shape, then why [?, ?] comes out?.. Am I doing anything wrong? How to debug it?

Thx in advance…

import tensorflow as tf
import tvm
from tvm import relay
from tvm.relay.frontend.tensorflow2 import from_tensorflow
import sys

def my_sparse_segment_sum(x,y,z):
    return tf.sparse.segment_sum(c, tf.constant([0, 1]), tf.constant([0, 1]))

c = tf.constant([[1,2,3,4], [-1,-2,-3,-4], [5,6,7,8]])

g=my_sparse_segment_sum.get_concrete_function(c, tf.constant([0, 1]), tf.constant([0, 1])).graph
gdef = g.as_graph_def(add_shapes=True), logdir="models", name="graph.pb", as_text=False)

mod, params=from_tensorflow(gdef, shape={"x":(3,4), "y":(2,), "z":(2,)})

target = 'llvm'

dev = tvm.device("cpu", 0)
with tvm.transform.PassContext(opt_level=3):
    lib =, target=target, params=params)

Hello, did you figure this out?