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

added segment_mean #21910

Closed
wants to merge 4 commits into from
Closed

Conversation

VanshAgarwal12113097
Copy link

@VanshAgarwal12113097 VanshAgarwal12113097 commented Aug 15, 2023

Close #21910

@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! 🎉👨‍💻

@ivy-leaves ivy-leaves added the TensorFlow Frontend Developing the TensorFlow Frontend, checklist triggered by commenting add_frontend_checklist label Aug 15, 2023
@ivy-leaves
Copy link

If you are working on an open task, please edit the PR description to link to the issue you've created.

For more information, please check ToDo List Issues Guide.

Thank you 🤗

@VanshAgarwal12113097
Copy link
Author

Hi DragosStoican could you plz view this pr and seggest some change

@DragosStoican
Copy link
Contributor

DragosStoican commented Aug 18, 2023

Hi @VanshAgarwal12113097 , thanks for your contribution!

Firstly, can you link the issue that this PR is addressing by commenting "close #issue_nuber".

Regarding the PR, please make sure that all the tests are passing, I've ran the test and got 5/5 failures right now 🙁

@@ -549,6 +549,22 @@ def tanh(x, name=None):
def rsqrt(x, name=None):
return ivy.reciprocal(ivy.sqrt(x))

@to_ivy_arrays_and_back
def segment_mean(
data, segment_ids, name="segment_mean"
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be name=None I think

# segment_mean
@handle_frontend_test(
fn_tree="tensorflow.math.segment_mean",
data=helpers.array_values(dtype=ivy.int32, shape=(5, 6), min_value=1, max_value=9),
Copy link
Contributor

Choose a reason for hiding this comment

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

We should test for all valid dtypes of data, not just int32

on_device,
):
helpers.test_frontend_function(
input_dtypes=["int32", "int64"],
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we not generate those using dtype_and_x in the handle_frontend_test decrator like we do for the other tests?

)
x = ivy.zeros(tuple([segment_ids[-1] + 1] + (list(data.shape))[1:]))
count = ivy.zeros((segment_ids[-1] + 1,))
for i in range((segment_ids).shape[0]):
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you investigate weather this could be done using the ivy functional API instead of for loops. I haven't given it much thought, but can you not use ivy.mean to calculate the mean of each segment?

# segment_mean
@handle_frontend_test(
fn_tree="tensorflow.math.segment_mean",
data=helpers.array_values(dtype=ivy.int32, shape=(5, 6), min_value=1, max_value=9),
Copy link
Contributor

Choose a reason for hiding this comment

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

Why can we not use dtype_and_x?

@VanshAgarwal12113097
Copy link
Author

VanshAgarwal12113097 commented Aug 19, 2023

ok thanks for help

@VanshAgarwal12113097
Copy link
Author

sir I have updated the pr and the test case 1 is also passed but due to some reason testcase 99 is failing plz review the pr and help. Also plz tell try merging is blocked message is showing

@VanshAgarwal12113097
Copy link
Author

close #21910

@DragosStoican
Copy link
Contributor

Hi @VanshAgarwal12113097 , please re-read the instructions for contributing to our frontend API here. You must choose a function from one of the ToDo lists, and the open an issue with the name of that function, which you will then link here via a comment Close #issue_number. You have linked the PR number, not the issue number. I need to know this function is on one of the ToDo lists and we need to make sure no one else is already working on it.

You should run the tests locally to see your results, instead of relying on the CI pipeline. You can read more about setting up your development environment here. Right now the test are failing due to a syntax error on line 1972.

@ivy-seed ivy-seed added the Stale label Sep 30, 2023
@ivy-seed
Copy link

This PR has been labelled as stale because it has been inactive for more than 7 days. If you would like to continue working on this PR, then please add another comment or this PR will be closed in 7 days.

@ivy-seed
Copy link

This PR has been closed because it has been marked as stale for more than 7 days with no activity.

@ivy-seed ivy-seed closed this Oct 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Stale TensorFlow Frontend Developing the TensorFlow Frontend, checklist triggered by commenting add_frontend_checklist
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants