-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
added segment_mean #21910
Conversation
Thanks for contributing to Ivy! 😊👏 |
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 🤗 |
Hi DragosStoican could you plz view this pr and seggest some change |
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" |
There was a problem hiding this comment.
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), |
There was a problem hiding this comment.
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"], |
There was a problem hiding this comment.
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]): |
There was a problem hiding this comment.
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), |
There was a problem hiding this comment.
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?
ok thanks for help |
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 |
close #21910 |
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 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. |
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. |
This PR has been closed because it has been marked as stale for more than 7 days with no activity. |
Close #21910