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.ReduceMean.rst 1.5 kB

4 years ago
123456789101112131415161718192021222324252627282930313233
  1. mindspore.ops.ReduceMean
  2. =========================
  3. .. py:class:: mindspore.ops.ReduceMean(keep_dims=False)
  4. 默认情况下,输出Tensor各维度上的平均值,以达到对所有维度进行归约的目的。也可以对指定维度进行求平均值归约。
  5. 通过指定 `keep_dims` 参数,来控制输出和输入的维度是否相同。
  6. **参数:**
  7. - **keep_dims** (bool) - 如果为True,则保留计算的维度,长度为1。如果为False,则不保留计算维度。默认值:False,输出结果会降低维度。
  8. **输入:**
  9. - **x** (Tensor[Number]) - ReduceMean的输入,任意维度的Tensor,秩应小于8。其数据类型为number。
  10. - **axis** (Union[int, tuple(int), list(int)]) - 指定计算维度。默认值:(),即计算所有元素的平均值。只允许常量值,取值范围[-rank(`x`), rank(`x`))。
  11. **输出:**
  12. Tensor,shape与输入 `x` 相同。
  13. - 如果轴为(),且keep_dims为False,则输出一个0维Tensor,表示输入Tensor中所有元素的平均值。
  14. - 如果轴为int,取值为2,并且keep_dims为False,则输出的shape为 :math:`(x_1, x_3, ..., x_R)` 。
  15. - 如果轴为tuple(int)或list(int),取值为(2, 3),并且keep_dims为False,则输出的shape为 :math:`(x_1, x_4, ..., x_R)` 。
  16. **异常:**
  17. - **TypeError** - `keep_dims` 不是bool。
  18. - **TypeError** - `x` 不是Tensor。
  19. - **TypeError** - `axis` 不是int、tuple或list。