You are viewing a plain text version of this content. The canonical link for it is here.
Posted to discuss-archive@tvm.apache.org by "Tianqi Zhang via Apache TVM Discuss (张天启)" <no...@discuss.tvm.ai> on 2021/06/29 07:31:43 UTC
[Apache TVM Discuss] [Application] [Relay] [NN] Does relay.nn.dense
supports multi-dimensional input?
The [doc](https://tvm.apache.org/docs/api/python/relay/nn.html#tvm.relay.nn.dense) says `relay.nn.dense` can have input tensors with shape `(d_1, d_2, …, d_n, units_in)`. However when I use a 3d tensor as the input of dense, I get this error:
```
File "/root/anaconda3/envs/tvm0.8-dev/lib/python3.7/site-packages/tvm-0.8.dev1067+g2cde3dc0e-py3.7-linux-x86_64.egg/tvm/_ffi/_ctypes/packed_func.py", line 81, in cfun
rv = local_pyfunc(*pyargs)
File "/root/anaconda3/envs/tvm0.8-dev/lib/python3.7/site-packages/tvm-0.8.dev1067+g2cde3dc0e-py3.7-linux-x86_64.egg/tvm/relay/op/strategy/generic.py", line 726, in _compute_dense
return [topi_compute(*args)]
File "/root/anaconda3/envs/tvm0.8-dev/lib/python3.7/site-packages/tvm-0.8.dev1067+g2cde3dc0e-py3.7-linux-x86_64.egg/tvm/autotvm/task/topi_integration.py", line 162, in wrapper
node = topi_compute(cfg, *args)
File "/root/anaconda3/envs/tvm0.8-dev/lib/python3.7/site-packages/tvm-0.8.dev1067+g2cde3dc0e-py3.7-linux-x86_64.egg/tvm/topi/x86/dense.py", line 215, in dense_pack
M, K = get_const_tuple(data.shape) # batch, in_dim
ValueError: too many values to unpack (expected 2)
```
I'm confused. Does `relay.nn.dense` currently only supports 2d tensor as the input?
---
[Visit Topic](https://discuss.tvm.apache.org/t/relay-nn-does-relay-nn-dense-supports-multi-dimensional-input/10343/1) 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/d034fedadbecc81616e7f26df71b50bcf27a82ab2408464662a0060589e2c3fd).
[Apache TVM Discuss] [Questions] [Relay] [NN] Does relay.nn.dense
supports multi-dimensional input?
Posted by "Tianqi Zhang via Apache TVM Discuss (张天启)" <no...@discuss.tvm.ai>.
Thanks for the reply.
I also find `relay.nn.batch_matmul` has a similar problem (no transpose for `y`).
---
[Visit Topic](https://discuss.tvm.apache.org/t/relay-nn-does-relay-nn-dense-supports-multi-dimensional-input/10343/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/2555bb8c8e8412b0559011f98aaefed2014c327fc2cf694526f4c0a422fccd88).
[Apache TVM Discuss] [Questions] [Relay] [NN] Does relay.nn.dense
supports multi-dimensional input?
Posted by Chenfan via Apache TVM Discuss <no...@discuss.tvm.ai>.
Emm ... This seems to be a flaky problem.
The op representation of `dense` in relay support multi-dim(exp. doc string, shape functions), while the current computation(exp. `topi.nn.dense`) does not.
I guess that dense op is desinged to support multi-dim, but guys only added simpler computations and schedules which only support 2-dim to topi.
---
[Visit Topic](https://discuss.tvm.apache.org/t/relay-nn-does-relay-nn-dense-supports-multi-dimensional-input/10343/2) 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/6064de4f358a1c1470a48c06ad10e184fdbc94bd01ca726a67b7cf962ab3be60).
[Apache TVM Discuss] [Questions] [Relay] [NN] Does relay.nn.dense
supports multi-dimensional input?
Posted by Chenfan via Apache TVM Discuss <no...@discuss.tvm.ai>.
That will be really great!
I would like to help fix these if I have time. I've just added a `nn.matmul` to support the input tensors in transposed or non-transposed format.
---
[Visit Topic](https://discuss.tvm.apache.org/t/relay-nn-does-relay-nn-dense-supports-multi-dimensional-input/10343/5) 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/c4c4ba0df480e2c6b7649802b78a6d163ac1d5a474cfa329a2fc1046a71868c5).
[Apache TVM Discuss] [Questions] [Relay] [NN] Does relay.nn.dense
supports multi-dimensional input?
Posted by Andrew Zhao Luo via Apache TVM Discuss <no...@discuss.tvm.ai>.
Ah yes, in general I've noticed some schedules do not really follow the specification of the operation. I would personally open an issue. I've noticed this in the past.
---
[Visit Topic](https://discuss.tvm.apache.org/t/relay-nn-does-relay-nn-dense-supports-multi-dimensional-input/10343/4) 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/958d7d86e5364d3dffe4852469bd9f0d08100d1d492fe0ef8c5630882323ae62).
[Apache TVM Discuss] [Questions] [Relay] [NN] Does relay.nn.dense
supports multi-dimensional input?
Posted by Andrew Zhao Luo via Apache TVM Discuss <no...@discuss.tvm.ai>.
I opened an issue here: https://github.com/apache/tvm/issues/8412
I'll try to fix it if I have time this week.
---
[Visit Topic](https://discuss.tvm.apache.org/t/relay-nn-does-relay-nn-dense-supports-multi-dimensional-input/10343/6) 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/ae4fdf4a346d706ce812fcc4de9453b4d23cbd3e6639b7c76deaf752734440cf).