ivy-llc / ivy

Convert Machine Learning Code Between Frameworks
https://ivy.dev
Other
14.02k stars 5.74k forks source link

[Bug]Clarification and Correction for Function List in jax.numpy Namespace #25920

Open akshatvishu opened 1 year ago

akshatvishu commented 1 year ago

Problem Description:

I was going through the issue_list : Add creation functions to Jax frontend #8431 and found out that some of the function present there to implement are actually classes:

Task present in issue list which are classes:

and fromfile and fromiter that are also present in the issue_list are not implemented in the jax itself due them maybe being non-pure and thus, unsafe for use with JIT and otherJAX transformations.

refs: https://github.com/google/jax/blob/main/jax/_src/numpy/lax_numpy.py

Instead what can be done is to make open issue for:

bool_ = _make_scalar_type(np.bool_)
uint4 = _make_scalar_type(dtypes.uint4)
uint8 = _make_scalar_type(np.uint8)
uint16 = _make_scalar_type(np.uint16)
uint32 = _make_scalar_type(np.uint32)
uint64 = _make_scalar_type(np.uint64)
int4 = _make_scalar_type(dtypes.int4)
int8 = _make_scalar_type(np.int8)
int16 = _make_scalar_type(np.int16)
int32 = _make_scalar_type(np.int32)
int64 = _make_scalar_type(np.int64)
float8_e4m3fn = _make_scalar_type(dtypes.float8_e4m3fn)
float8_e5m2 = _make_scalar_type(dtypes.float8_e5m2)
float8_e4m3b11fnuz = _make_scalar_type(dtypes.float8_e4m3b11fnuz)
bfloat16 = _make_scalar_type(dtypes.bfloat16)
float16 = _make_scalar_type(np.float16)
float32 = single = _make_scalar_type(np.float32)
float64 = double = _make_scalar_type(np.float64)
complex64 = csingle = _make_scalar_type(np.complex64)
complex128 = cdouble = _make_scalar_type(np.complex128)

similar to uint16 #5130 and int16 #7677

Basically everything that uses _make_scalar_type can be made into an issue with the same name and can be added to ivy jax frontend at creation.py

Because currently if we try to implement any of the above classes in jax frontend then it throws error like Discord Link

Another similar issue was faced in-here too: https://github.com/unifyai/ivy/issues/11170

fnhirwa commented 1 year ago

Hey @akshatvishu

This issue was up on my radar, but I was still caught up in other things on my plate πŸ˜‚ Will surely get started on fixing this πŸ€—

Thanks for bringing it up 🫑

akshatvishu commented 1 year ago

Hey @akshatvishu

This issue was up on my radar, but I was still caught up in other things on my plate πŸ˜‚ Will surely get started on fixing this πŸ€—

Thanks for bringing it up 🫑

Thanks for looking into this @hirwa-nshuti !

Also, shall I close this issue now?

fnhirwa commented 1 year ago

Hey @akshatvishu This issue was up on my radar, but I was still caught up in other things on my plate πŸ˜‚ Will surely get started on fixing this πŸ€— Thanks for bringing it up 🫑

Thanks for looking into this @hirwa-nshuti !

Also, shall I close this issue now?

Will close it once everything is implemented πŸ™‚