Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

smooth_l1_loss #22378

Merged
merged 11 commits into from
Aug 24, 2023
Merged

smooth_l1_loss #22378

merged 11 commits into from
Aug 24, 2023

Conversation

sushmanthreddy
Copy link
Contributor

@sushmanthreddy sushmanthreddy commented Aug 22, 2023

close #21165

@github-actions
Copy link
Contributor

Thanks for contributing to Ivy! 😊👏
Here are some of the important points from our Contributing Guidelines 📝:
1. Feel free to ignore the run_tests (1), run_tests (2), … jobs, and only look at the display_test_results job. 👀 It contains the following two sections:
- Combined Test Results: This shows the results of all the ivy tests that ran on the PR. ✔️
- New Failures Introduced: This lists the tests that are passing on main, but fail on the PR Fork. Please try to make sure that there are no such tests. 💪
2. The lint / Check formatting / check-formatting tests check for the formatting of your code. 📜 If it fails, please check the exact error message in the logs and fix the same. ⚠️🔧
3. Finally, the test-docstrings / run-docstring-tests check for the changes made in docstrings of the functions. This may be skipped, as well. 📚
Happy coding! 🎉👨‍💻

This was referenced Aug 22, 2023
@ivy-leaves ivy-leaves added Array API Conform to the Array API Standard, created by The Consortium for Python Data API Standards Ivy API Experimental Run CI for testing API experimental/New feature or request PaddlePaddle Backend Developing the Paddle Paddle Backend. Ivy Functional API labels Aug 22, 2023
Copy link
Contributor

@Daniel4078 Daniel4078 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello, I suppose you need to implement the backend of your function for every framework available to allow your function to pass tests, not just paddle and torch.

@Daniel4078
Copy link
Contributor

by the way, you should have a look at the new guide line of how we should write commit messages: https://www.conventionalcommits.org/en/v1.0.0/. Thanks.

@sushmanthreddy
Copy link
Contributor Author

@Daniel4078 The problem here is smooth_l1_loss is and mixed function due to that only some backends have the implementation of smooth_l1_loss,oneis torch and paddle ,so that is the reason have implemented in this way.
link

Copy link
Contributor

@Daniel4078 Daniel4078 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say that you should still try to implement this function compositionally in other backend by recreating its intended behavior using combinations of other functions in the target backend framework.

@sushmanthreddy
Copy link
Contributor Author

i will work on it

@sushmanthreddy
Copy link
Contributor Author

@Daniel4078 I have implemented the backend support manually in respective frameworks of jax,numpy and tensorflow...can u pls review that,it might have some mistakes over them,pls review it once and let me knew any changes are needed?

Copy link
Contributor

@Daniel4078 Daniel4078 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update your branch with the main one as I found that your tests are failing due to an old problem: E ModuleNotFoundError: No module named 'dill'. Which has been patched out in recent commits on the ivy main branch.

@sushmanthreddy
Copy link
Contributor Author

@Daniel4078 i have updated it and pushed the code..Now tests are passing as u mentiioned
Screenshot from 2023-08-23 14-41-18

screenshot of it is

Copy link
Contributor

@Daniel4078 Daniel4078 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that it will be good for you slightly expand your docstring examples for your function like guided here(https://unify.ai/docs/ivy/overview/deep_dive/docstring_examples.html#docstring-examples). For example, some example requarding the use of reduction and out argument will be appreciated.

@sushmanthreddy
Copy link
Contributor Author

@Daniel4078 i have changed the doc strings any new changes are needed??

Copy link
Contributor

@Daniel4078 Daniel4078 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found a failing test of your function, please have a look:

E   ivy.utils.exceptions.IvyBackendException: paddle: execute_with_gradients: paddle: nested_map: paddle: nested_map: (Fatal) There is no grad op for inputs:[0] or it'sstop_gradient=True.
E     [Hint: target_node should not be null.] (at /paddle/paddle/fluid/eager/general_grad.h:72)
E   
E   Falsifying example: test_smooth_l1_loss(
E       backend_fw='paddle',
E       on_device='cpu',
E       dtype_and_input=(['float64'], [array([-1., -1., -1.])]),
E       dtype_and_target=(['float64'], [array([-1., -1., -1.])]),
E       beta=0.5,
E       reduction='none',
E       test_flags=FunctionTestFlags(
E           ground_truth_backend='tensorflow',
E           num_positional_args=2,
E           with_out=False,
E           instance_method=False,
E           test_gradients=True,
E           test_compile=False,
E           as_variable=[False],
E           native_arrays=[False],
E           container=[False],
E       ),
E       fn_name='smooth_l1_loss',
E   )

@sushmanthreddy
Copy link
Contributor Author

@Daniel4078 it has been failing for all of the loss function that is paddle bfloat16 issue or some backend issue.
If u check the for other loss functions ,which are implemented u can see that they will also fail for paddle only

@sushmanthreddy
Copy link
Contributor Author

@Daniel4078 here is the screenshot of it.
Screenshot from 2023-08-24 09-31-30

@Daniel4078
Copy link
Contributor

Maybe you can leave a comment in the relevent code saying this problem, then I can merge and let other ivy members to deal with this global problem.

@sushmanthreddy
Copy link
Contributor Author

@Daniel4078 i have added in the doc string mentioning the error..can u pls review it ?

Copy link
Contributor

@Daniel4078 Daniel4078 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good for me!

@Daniel4078 Daniel4078 merged commit 01cc670 into ivy-llc:main Aug 24, 2023
@sushmanthreddy sushmanthreddy deleted the smooth_l1_loss branch August 24, 2023 06:39
arshPratap pushed a commit to arshPratap/ivy that referenced this pull request Sep 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Array API Conform to the Array API Standard, created by The Consortium for Python Data API Standards Ivy API Experimental Run CI for testing API experimental/New feature or request Ivy Functional API PaddlePaddle Backend Developing the Paddle Paddle Backend.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

smooth_l1_loss
3 participants