Skip to content

Commit

Permalink
adding _wrapper in ceil function at _spec_elementwise_functions.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ohrechykha committed Aug 8, 2024
1 parent 63fa3ee commit fc0de45
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/ragged/_spec_elementwise_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit fc0de45

Please sign in to comment.