From fc0de45bfdd309a38d23eed742f12810635a5ebd Mon Sep 17 00:00:00 2001 From: ohrechykha Date: Thu, 8 Aug 2024 10:42:25 +0300 Subject: [PATCH] adding _wrapper in ceil function at _spec_elementwise_functions.py --- src/ragged/_spec_elementwise_functions.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/ragged/_spec_elementwise_functions.py b/src/ragged/_spec_elementwise_functions.py index 3357c6c..0905e9a 100644 --- a/src/ragged/_spec_elementwise_functions.py +++ b/src/ragged/_spec_elementwise_functions.py @@ -413,8 +413,16 @@ def ceil(x: array, /) -> array: https://data-apis.org/array-api/latest/API_specification/generated/array_api.ceil.html """ - - return _box(type(x), np.ceil(*_unbox(x)), dtype=x.dtype) + def _wrapper(dtype): + if dtype in [np.int8, np.uint8, np.bool_, np.bool]: + return np.float16 + elif dtype in [np.int16, np.uint16]: + return np.float32 + elif dtype in [np.int32, np.uint32, np.int64, np.uint64]: + return np.float64 + else: + return dtype + return _box(type(x), np.ceil(*_unbox(x)), _wrapper(x.dtype)) def conj(x: array, /) -> array: