Skip to content

added zeta in paddle elementwise.py#13409

Merged
MahmoudAshraf97 merged 8 commits into
unifyai:masterfrom
vandit98:zeta
Apr 3, 2023
Merged

added zeta in paddle elementwise.py#13409
MahmoudAshraf97 merged 8 commits into
unifyai:masterfrom
vandit98:zeta

Conversation

@vandit98
Copy link
Copy Markdown
Contributor

zeta #13408

Copy link
Copy Markdown
Contributor

@MahmoudAshraf97 MahmoudAshraf97 left a comment

Choose a reason for hiding this comment

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

don't forget the unsupported ditypes decorator, uint16 and bfloat16 are unsupported in all functions, and if there are more dtypes that you cant support, add them accordingly

@with_unsupported_device_and_dtypes(
    {"2.4.2 and below": {"cpu": ("uint16", "bfloat16")}}, backend_version
)

also the result is different than the ground truth, this is also a problem in the numpy implementation where this is derived from, so you will need to rethink this again

E           AssertionError:  the results from backend paddle and ground truth framework tensorflow do not match
E            [2.]!=[1.64493407] 
E           
E           
E           Falsifying example: test_zeta(
E               dtype_and_x=(['float64', 'float64'], [array([2.]), array([1.])]),

temp = ivy.logical_and(ivy.not_equal(ivy.remainder(x, 2), 0), ivy.greater(x, 1))
temp = ivy.logical_and(temp, ivy.less_equal(q, 0))
nan_indices = ivy.logical_or(temp, ivy.less(x, 1))
n, res = 1, 1 / q**x
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

in this line and the following lop there are two issues:

  1. q and x are tensors, so use ivy elementwise ops instead, ivy.add instead of + for example
  2. this implementation is extremely slow compared to other backends and I thinks it's because of this loop

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yes, I agree
I will make the changes.

@vandit98 vandit98 requested a review from MahmoudAshraf97 April 3, 2023 08:20
@vandit98
Copy link
Copy Markdown
Contributor Author

vandit98 commented Apr 3, 2023

hi @MahmoudAshraf97
Please review my changes. Test are passing.
Screenshot from 2023-04-03 13-52-22

I have used jax implementation and also we need to update numpy backend zeta function.
I will be happy to do it as well.
Thanks

vandit98 and others added 2 commits April 3, 2023 14:50
Copy link
Copy Markdown
Contributor

@MahmoudAshraf97 MahmoudAshraf97 left a comment

Choose a reason for hiding this comment

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

Good work

@MahmoudAshraf97 MahmoudAshraf97 merged commit 7f93aa4 into unifyai:master Apr 3, 2023
MuhammedAshraf2020 pushed a commit to MuhammedAshraf2020/ivy that referenced this pull request Apr 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants