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


##########
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:
   Traditionally, a multinomial distribution would enforce that these 
probabilities are all non-negative. It doesn't look like you're enforcing that 
condition here. Is that intentional? If so, please add a comment describing 
what should happen in the case of negative probabilities.



-- 
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: commits-unsubscr...@tvm.apache.org

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

Reply via email to