fridom.framework.utils.array_ops.array_is_constant#
- fridom.framework.utils.array_ops.array_is_constant(arr: ndarray) bool[source]#
Check if an array is constant.
Description#
This function checks if all elements of an array are the same.
Parameters#
- arrnp.ndarray
The array to check.
Returns#
- bool
True if the array is constant, False otherwise.
Examples#
>>> import fridom.framework as fr >>> x = fr.config.ncp.ones(10) >>> fr.utils.array_is_constant(x) True >>> x[5] = 0 >>> fr.utils.array_is_constant(x) False