mindspore/docs/api/api_python/ops/mindspore.ops.Multinomial.rst

28 lines
1.2 KiB
ReStructuredText
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

mindspore.ops.Multinomial
==========================
.. py:class:: mindspore.ops.Multinomial(seed=0, seed2=0, dtype=mstype.int32)
返回从输入Tensor对应行进行多项式概率分布采样出的Tensor。
.. note::
输入的行不需要求和为1(在这种情况下,我们使用值作为权重),但必须是非负的、有限的,并且具有非零和。
参数:
- **seed** (int) - 随机数种子必须是非负数。默认值0。
- **seed2** (int) - 二号随机数种子必须是非负数。默认值0。
- **dtype** (dtype) - 输出数据类型必须是int32或者int64默认类型int32。
输入:
- **x** (Tensor) - 包含累加概率和的输入Tensor必须是一维或二维。
- **num_samples** (int) - 要抽取的样本数。
输出:
Tensor具有与输入相同的行。每行的采样索引数为 `num_samples`
异常:
- **TypeError** - 如果 `seed` 或者 `seed2` 不是int类型。
- **TypeError** - 如果 `num_sample` 不是int类型。
- **TypeError** - 如果 `dtype` 不是int32或者int64类型。
- **ValueError** - 如果 `seed` 或者 `seed2` 小于零。