Another work around is to get rid off the sparse placeholder completely. Instead use three standard Tensors for each element in the sparse tensor (i.e. data, indices and index pointers). Then feed those (plus the X matrix) to topi.nn.sparse_dense
and things seem to work.
There’s a working implementation in this repo:
@autotvm.template("benchmark/block_sparse")
def block_sparse_template(W_sp_np_data_shape, W_sp_np_indices_shape, W_sp_np_indptr_shape, X_np_shape):
W_data = te.placeholder(shape=W_sp_np_data_shape, dtype='float32', name='W_data')
W_indices = te.placeholder(shape=W_sp_np_indices_shape, dtype='int32', name='W_indices')
W_indptr = te.placeholder(shape=W_sp_np_indptr_shape, dtype='int32', name='W_indptr')
X = te.placeholder(shape=X_np_shape, dtype='float32', name='X')
Y = topi.nn.sparse_dense(X, W_data, W_indices, W_indptr)
...