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.nn.Top1CategoricalAccuracy.rst 657 B

123456789101112131415161718
  1. mindspore.nn.Top1CategoricalAccuracy
  2. ====================================
  3. .. py:class:: mindspore.nn.Top1CategoricalAccuracy
  4. 计算top-1分类正确率。此类是TopKCategoricalAccuracy的特殊类。有关更多详细信息,请参阅 :class:`TopKCategoricalAccuracy`。
  5. **样例:**
  6. >>> x = Tensor(np.array([[0.2, 0.5, 0.3, 0.6, 0.2], [0.1, 0.35, 0.5, 0.2, 0.],
  7. ... [0.9, 0.6, 0.2, 0.01, 0.3]]), mindspore.float32)
  8. >>> y = Tensor(np.array([2, 0, 1]), mindspore.float32)
  9. >>> topk = nn.Top1CategoricalAccuracy()
  10. >>> topk.clear()
  11. >>> topk.update(x, y)
  12. >>> output = topk.eval()
  13. >>> print(output)
  14. 0.0