ivy icon indicating copy to clipboard operation
ivy copied to clipboard

added rfftn function at backend

Open rajveer43 opened this issue 2 years ago • 3 comments

Close #18035

rajveer43 avatar Jun 29 '23 13:06 rajveer43

@Fayad-Alman, I proposed adding the RFFTN function to Ivy's Experimental API. would you tell me which other files I need to add the function?

rajveer43 avatar Jun 29 '23 14:06 rajveer43

Hi @rajveer43, for this function you'll have to add the backend implementation to the layers.py file of every backend framework. Once that's done, add the function to the ivy array API (layers.py in the array folder) and container class as well (layers.py in the container folder).

After all of this is complete, the final step is creating a test for this function. Go to ivy_tests/test_ivy/test_functional/test_experimental/test_nn/test_layers.py and add the test.

Let me know if you have any questions!

Fayad-Alman avatar Jun 29 '23 18:06 Fayad-Alman

Hi @rajveer43, for this function you'll have to add the backend implementation to the layers.py file of every backend framework. Once that's done, add the function to the ivy array API (layers.py in the array folder) and container class as well (layers.py in the container folder).

After all of this is complete, the final step is creating a test for this function. Go to ivy_tests/test_ivy/test_functional/test_experimental/test_nn/test_layers.py and add the test.

Let me know if you have any questions!

changed the files as you suggested. let me know I have put the functions in the right file. if there is any change in the location of the functions I will do it ASAP.

@Fayad-Alman kindly let me know whether I have done correctly or not!

rajveer43 avatar Jun 30 '23 17:06 rajveer43

@Fayad-Alman Would you please check the PR?

rajveer43 avatar Jul 05 '23 13:07 rajveer43

@Fayad-Alman, All the tests are passing now.

  • [x] Jaxbackend - test
  • [x] tensorflowbackend test
  • [x] paddle backend test
  • [x] pytorch backend test
  • [x] Numpy backend test

##tensorflow the main problem is that for the tensorflow backend. Do I need to handle exception handling for all frameworks in the rfftn function, or is it sufficient to handle it only for TensorFlow (tf) due to its specific functions rfft1d, rfft2d, and rfft3d? I think I have to add that and I have added..

also there was a change in the testing. Now no need to specify ground truth parameters when testing a function all of this is being handled by the test_flags updates were made in this commit. https://github.com/unifyai/ivy/commit/b799660a2182217270b8045e94c2b85dda7dc903

During our conversation, we encountered an issue where the TensorFlow tests were not triggered while running the tests. The problem was due to the use of the ground_truth_backend parameter, which was not properly configured in the test setup and it was resolved by the above commit. According to @hirwa-nshuti, he mentioned that since TensorFlow is considered the default ground truth, its tests are always skipped. but then the issue was solved and Tensorflow passed but sometimes it falis too..

Also there are two implementations of rfftn at tensorflow backend. let me know which one is better and which one to keep in the backend! the one with the helper function, norm function and input validation function is passing sometimes and failing sometimes! hope that is not a major issue.

Do let me know if other changes are required like formatting, function definition change, dtype change, arguments changelike number of positional and keyword agroument change. etc. attaching thesnapshot` of the local-tests passing.

Screenshot (759) Screenshot (760)

rajveer43 avatar Jul 10 '23 06:07 rajveer43

@Fayad-Alman, Also I want to you to review this PR regularly for next 2-3 days and suggest the changes I will make asap as I need to complete the issue #16357 as well.

rajveer43 avatar Jul 11 '23 08:07 rajveer43