mlx.core.round

目录

mlx.core.round#

round(a: array, /, decimals: int = 0, stream: None | Stream | Device = None) array#

四舍五入到指定的小数位数。

基本执行操作

s = 10**decimals
x = round(x * s) / s
参数:
  • a (array) – 输入数组

  • decimals (int) – 要四舍五入到的小数位数。(默认值:0)

返回值:

一个与 a 类型相同,并四舍五入到指定小数位数的数组。

返回类型:

array