jwfromm commented on code in PR #12284:
URL: https://github.com/apache/tvm/pull/12284#discussion_r937205819


##########
python/tvm/topi/random/kernel.py:
##########
@@ -602,3 +602,57 @@ def normal(gen, mean, scale, out_shape, out_dtype):
     )
 
     return new_gen, random_values
+
+
+def multinomial(gen, probs, num_samples):
+    """Draw samples from a multinomial distribution defined by the input 
tensor.
+
+    Parameters
+    ----------
+    gen : ThreefryKey
+        Generator state. Can be create with :py:func:`tvm.relay.threefry_key`. 
This should not be
+        reused in another function, otherwise random numbers will be repeated.
+
+    probs: Tensor[(input_rows, indices), float]

Review Comment:
   I dont think there's a good way to check for negative values at runtime 
without introducing control flow (which we'd like to avoid). Do you think it's 
a fair interpretation to say that incoming negative values should have 0% 
chance of being selected? If so, I could insert a `clip` before processing the 
data to replace negative values with 0.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to