You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

mindspore.ops.ComputeAccidentalHits.rst 1.6 kB

12345678910111213141516171819202122232425262728293031
  1. mindspore.ops.ComputeAccidentalHits
  2. =====================================
  3. .. py:class:: mindspore.ops.ComputeAccidentalHits(num_true=1)
  4. 计算与目标类完全匹配的抽样样本的位置id。
  5. 当目标类与抽样类匹配时,我们称之为"accidental hit"。accidental hit的计算结果包含三部分(indices、ids、weights),其中index代表目标类中的行号,id代表候选抽样中的位置,weight为float类型中的最大值。
  6. **参数:**
  7. - **num_true** (int) - 每个训练样本的目标类数。默认值:1。
  8. **输入:**
  9. - **true_classes** (Tensor) - 目标类。数据类型为int32或int64,shape为 :math:`(batch\_size, num\_true)` 。
  10. - **sampled_candidates** (Tensor) - 算子的候选采样结果,代表训练样本的类别。其数据类型为int32或int64,shape为 :math:`(num\_sampled, )` 。
  11. **输出:**
  12. 3个Tensor组成的元组。
  13. - **indices** (Tensor) - shape为 :math:`(num\_accidental\_hits, )` 的Tensor,具有与 `true_classes` 相同的类型。
  14. - **ids** (Tensor) - shape为 :math:`(num\_accidental\_hits, )` 的Tensor,具有与 `true_classes` 相同的类型。
  15. - **weights** (Tensor) - shape为 :math:`(num\_accidental\_hits, )` 的Tensor,类型为float32。
  16. **异常:**
  17. - **TypeError** - `num_true` 的数据类型不为int。
  18. - **TypeError** - `true_classes` 或 `sampled_candidates` 不是Tensor。
  19. - **TypeError** - `true_classes` 或 `sampled_candidates` 的数据类型既不是int32也不是int64。