mlx.core.nan_to_num#
- nan_to_num(a: scalar | array, nan: float = 0, posinf: float | None = None, neginf: float | None = None, *, stream: None | Stream | Device = None) array#
Replace NaN and Inf values with finite numbers.
- 参数:
a (array) -- Input array
nan (float, optional) -- Value to replace NaN with. Default:
0.posinf (float, optional) -- Value to replace positive infinities with. If
None, defaults to largest finite value for the given data type. Default:None.neginf (float, optional) -- Value to replace negative infinities with. If
None, defaults to the negative of the largest finite value for the given data type. Default:None.
- 返回:
Output array with NaN and Inf replaced.
- 返回类型: