eric-haibin-lin commented on a change in pull request #12749: [MXNET-1029] 
Feature request: randint operator
URL: https://github.com/apache/incubator-mxnet/pull/12749#discussion_r233208156
 
 

 ##########
 File path: src/operator/random/sampler.h
 ##########
 @@ -92,6 +92,33 @@ struct UniformSampler {
   }
 };
 
+template<typename xpu>
+struct SampleRandIntKernel {
+  template<typename IType, typename OType>
+  MSHADOW_XINLINE static void Map(int id, RandGenerator<xpu, OType> gen,
+                                  const int N, const int step,
+                                  index_t nParm, index_t nSample,
+                                  const IType *lower, const IType *upper, 
OType *out) {
+    RNG_KERNEL_LOOP(xpu, OType, id, gen, N, step, {
+      index_t nBatch(1 + (nSample - 1) / nParm);
+      out[i] = OType(genImpl.discrete_uniform(lower[i / nBatch], upper[i / 
nBatch]));
 
 Review comment:
   call genImpl.rand<IType>()

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to