ivy
ivy copied to clipboard
added frontend jax numpy namespace function sum
Close https://github.com/unifyai/ivy/issues/6317
Hey:) Got some problem with implementation promote_integers argument for the sum function. How is better to implement it?
Excerpt from Jax _reduction
source:
if dtype is None and promote_integers:
# Note: NumPy always promotes to 64-bit; jax instead promotes to the
# default dtype as defined by dtypes.int_ or dtypes.uint.
if dtypes.issubdtype(result_dtype, np.bool_):
result_dtype = dtypes.int_
elif dtypes.issubdtype(result_dtype, np.unsignedinteger):
if np.iinfo(result_dtype).bits < np.iinfo(dtypes.uint).bits:
result_dtype = dtypes.uint
elif dtypes.issubdtype(result_dtype, np.integer):
if np.iinfo(result_dtype).bits < np.iinfo(dtypes.int_).bits:
result_dtype = dtypes.int_
dtypes.int_
will normally be a int64
and dtypes.uint
is a uint64
but you should check what is available during function call.
Ivy has types listed under ivy/__init__.py
that you can use to implement the type comparison logic.
Hello:) I've implemented the argument with your help. Thank you so much! Could you please have a look?
Looks good to me, just needs a merge.
@Nightcrab Thank you:) Should we ping someone?
No need, I'm able to merge the PR into ivy as long as there aren't conflicts.
@Nightcrab Done