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](https://github.com/ceruleangu/Block-Sparse-Benchmark):

```
@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)
    ...
```





---
[Visit 
Topic](https://discuss.tvm.apache.org/t/pass-sparse-tensor-to-tvm-build/7739/3) 
to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click 
here](https://discuss.tvm.apache.org/email/unsubscribe/25c4d871ca6183c7b3dfc00b30bc3e7af3fd1797038b3df3e5e05de0977a7fd9).

Reply via email to