You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@mxnet.apache.org by "mureva (via GitHub)" <gi...@apache.org> on 2023/05/01 14:32:25 UTC

[GitHub] [mxnet] mureva opened a new issue, #21195: gather_nd vs. take

mureva opened a new issue, #21195:
URL: https://github.com/apache/mxnet/issues/21195

   I have an observation and I'm hoping someone can advise.
   
   I have a scenario where I maintain a large table of vectors, so a basic (n,m) array of n vectors of size m. I then have some system that generates indices into this table, and I want to pull rows out of the table at those indices. (more background? A hash table version of NeRF is what we're making).
   
   So, I have a set of indices, and I want to gather the rows out of the table to make use of elsewhere. There's two operators in mxnet that will do the job - `gather_nd` and `take`
   
   I could have more than 100k, even 1000k indices:
   
     - at 100k  `take` will do a forward pass in less than 1 ms, but a backward pass will take about 45 ms. Meanwhile, `gather_nd` will do a forward pass in about 16 ms, and a backward pass in under 1 ms.
     -  At 1000k indices, `take` is 4 ms fwd, 400 ms bwd, gather is 170 ms fwd, 1ms bwd. . 
   
   So... obvious question... is there a way to get the best of both worlds here? The fast forward pass of `take`, the fast backward pass of `gather_nd`?
   
   Is there a better operator for gathering rows from the table?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org
For additional commands, e-mail: issues-help@mxnet.apache.org


[GitHub] [mxnet] mureva closed issue #21195: gather_nd vs. take

Posted by "mureva (via GitHub)" <gi...@apache.org>.
mureva closed issue #21195: gather_nd vs. take
URL: https://github.com/apache/mxnet/issues/21195


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org
For additional commands, e-mail: issues-help@mxnet.apache.org


[GitHub] [mxnet] mureva commented on issue #21195: gather_nd vs. take

Posted by "mureva (via GitHub)" <gi...@apache.org>.
mureva commented on issue #21195:
URL: https://github.com/apache/mxnet/issues/21195#issuecomment-1529792880

   Had another look through the documentation, and though I hadn't thought of it that way, the other option is to use the embedding function. And woderfully, that appears to be the best of both worlds that I wanted, 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org
For additional commands, e-mail: issues-help@mxnet.apache.org