Close #17091
Close #17091
This PR is not complete, will need to add test function for ifftn frontend function.
3rd commit: Fixed alignment issue and included statement to check if s shape and array shape are the same. It is difficult to pad and crop on the frontend as it results in inconsistent results between ivy.ifftn and numpy.fft.ifftn, RECOMMENDED : Code an ivy.ifftn backend function using numpy to allow for cropping and padding when the array shape and s argument shape do not match.
Commit 4: Simplified and improved ifftn frontend function, now it is capable of handling zero padding and cropping via ivy.ifft.
Commit 5: Removed ortho normalization handling in function as this is already done by ivy.ifft.
@zhumakhan Could I get a review for my current work please? Thanks.
Commit 6: Added Test function for ifftn frontend The ifftn frontend test has a 66% pass rate and fails for tensorflow backend, this might be caused by the fact that the ifft function also fails with tensorflow backend. ifft backend might have a problem and requires checking, since ifftn is coded using ifft, the failure with tensorflow backend is expected. Future Work: implement wider testing parameters (however this requires ifft fix for tensorflow backend to for better implementation).
Commit 7: New ifftn function which works for a general case of any array, s and axes arguments!!!
@zhumakhan Could I get a review for my work so far please?
Commit 8: Simplified the previously complex ifftn function.
Commit 9: Updated test function, now tests have a 100% pass rate. Might have to code a different function similar to x_and_ifft(draw) to allow for data generation more catered towards the ifftn function.
Commit 10: Changed frontend ifftn function to include backend ivy.ifftn which was newly added.
Hi, thanks for your PR! It seems to me that ivy.ifftn should handle wrong arguments on its own. So there is no need to do argument checks in the frontend.
@with_unsupported_dtypes({"1.24.3 and below": ("float16",)}, "numpy")
@to_ivy_arrays_and_back
def ifftn(a, s=None, axes=None, norm=None):
a = ivy.array(a, dtype=ivy.complex128)
a = ivy.ifftn(a, s=s, axes=axes, norm=norm)
return a
Above implementation passes all the tests.
In addition to that, lets check if there are better ways of typecasting the input array. Currently it is done as below:
a = ivy.array(a, dtype=ivy.complex128)
Hi, thanks for your PR! It seems to me that ivy.ifftn should handle wrong arguments on its own. So there is no need to do argument checks in the frontend.
@with_unsupported_dtypes({"1.24.3 and below": ("float16",)}, "numpy") @to_ivy_arrays_and_back def ifftn(a, s=None, axes=None, norm=None): a = ivy.array(a, dtype=ivy.complex128) a = ivy.ifftn(a, s=s, axes=axes, norm=norm) return aAbove implementation passes all the tests.
In addition to that, lets check if there are better ways of typecasting the input array. Currently it is done as below:
a = ivy.array(a, dtype=ivy.complex128)
@zhumakhan , should'nt the type casting be similar to that of the ifft function which is also ivy.complex128?
Commit 11: Removed argument checks and changed type casting from "ivy.array" to "ivy.asarray" to handle type casting more flexibly and efficiently.
Hi, currently it is failing all of the tests. Could please update this PR accordingly to pass all of the tests? Thanks!
LGTM!