connorgoggins opened a new pull request #17599: Fixed Embedding op for LT input
URL: https://github.com/apache/incubator-mxnet/pull/17599
 
 
   ## Description ##
   The Embedding op was previously breaking on large tensor (dimension >= 2^32) 
data. With the following input:
   ```
   nd.Embedding(data=nd.random_normal(shape=(2**32,1)), 
weight=nd.random_normal(shape=(2**32,1)), input_dim=2**32, output_dim=1)
   ```
   the following error was thrown:
   ```
   mxnet.base.MXNetError: MXNetError: Invalid Parameter format for input_dim 
expect int but value='4294967296', in operator Embedding(name="", 
output_dim="1", input_dim="4294967296")
   ```
   
   To fix this issue, I modified `indexing_op.h` to switch from storing 
input_dim as an `int` to storing it as an `index_t`. After implementing my fix 
and rebuilding, the previous input command displayed the correct output:
   ```
   [[[-0.5190417]]
   
    [[-1.4388928]]
   
    [[ 1.1367434]]
   
    ...
   
    [[-1.4388928]]
   
    [[-1.4388928]]
   
    [[-0.5190417]]]
   <NDArray 4294967296x1x1 @cpu(0)>
   ```
   
   ## Checklist ##
   ### Essentials ###
   Please feel free to remove inapplicable items for your PR.
   - [x] Changes are complete (i.e. I finished coding on this PR)
   - [x] All changes have test coverage
   - [x] Code is well-documented
   - [x] To the best of my knowledge, examples are either not affected by this 
change, or have been fixed to be compatible with this change
   
   ### Changes ###
   - M src/operator/tensor/indexing_op.h
   
   ## Comments ##
   Tested on r5dn.24xl-ubuntu 16.04 and p2.16xl-ubuntu 16.04 with
   1. Individual op run
   2. Full OpPerf run
   
   ## Results ##
   [Single operator test - Embedding op 
(GPU)](https://gist.github.com/connorgoggins/2ead27ac3b142e458ddba43eb4093bf7)
   [Single operator test - Embedding op 
(CPU)](https://gist.github.com/connorgoggins/cdd5659abd5d2152a29f44a1f1ee03c7)
   
   [Full OpPerf test 
(GPU)](https://gist.github.com/connorgoggins/09131cdbbdcbba1dc39a93099dccaad4)
   [Full OpPerf test 
(CPU)](https://gist.github.com/connorgoggins/3fc3c7a40dae8b5cea7f82d9ca4b1a72)
   
   @apeforest @access2rohit 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to