You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2019/12/23 09:22:50 UTC

[GitHub] [incubator-tvm] FrozenGene commented on issue #4572: What is an acceptable way to write an one_hot with hybrid_script?

FrozenGene commented on issue #4572: What is an acceptable way to write an one_hot with hybrid_script?
URL: https://github.com/apache/incubator-tvm/issues/4572#issuecomment-568415359
 
 
   ```python
   import tvm
   import numpy as np
   @tvm.hybrid.script
   def one_hot(a):
       c = output_tensor((a.shape[0] * 10, ), 'float32')
       for i in range(a.shape[0]):
           c[i * 10 + a[i]] = 1
       return c
   
   a = tvm.placeholder((100, ), dtype="int")
   one_hot(a)
   ```
   This could work.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services