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

Fix Frontend Failing Test: tensorflow - mathematical_functions.jax.numpy.sinc #28677

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

ZJay07
Copy link
Contributor

@ZJay07 ZJay07 commented Mar 24, 2024

PR Description

image
bfloat16 seems to be not supported in the tensorflow backend for sinc

Related Issue

Close #28676

Checklist

  • Did you add a function?
  • Did you add the tests?
  • Did you run your tests and are your tests passing?
  • Did pre-commit not fail on any check?
  • Did you follow the steps we provided?

Socials

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

PR Compliance Checks

Thank you for your Pull Request! We have run several checks on this pull request in order to make sure it's suitable for merging into this project. The results are listed in the following section.

Issue Reference

In order to be considered for merging, the pull request description must refer to a specific issue number. This is described in our contributing guide and our PR template.
This check is looking for a phrase similar to: "Fixes #XYZ" or "Resolves #XYZ" where XYZ is the issue number that this PR is meant to address.

Conventional Commit PR Title

In order to be considered for merging, the pull request title must match the specification in conventional commits. You can edit the title in order for this check to pass.
Most often, our PR titles are something like one of these:

  • docs: correct typo in README
  • feat: implement dark mode"
  • fix: correct remove button behavior

Linting Errors

  • Found type "null", must be one of "feat","fix","docs","style","refactor","perf","test","build","ci","chore","revert"
  • No subject found

Copy link
Contributor

@Ishticode Ishticode left a comment

Choose a reason for hiding this comment

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

Thank you very much @ZJay07 for the PR
You are right in recognizing that ivy.sinc with tf backend throws an error but this looks like an ivy issue. Becaue the code in the actual implementation works with native tensorflow as in

import tensorflow as tf
x = tf.constant([1, 2, 3.], dtype=tf.bfloat16)
x = x*3.14
print(tf.cast(tf.where(x == 0, 1, tf.math.sin(x) / x), x.dtype))

which means it does support bfloat16 natively.
Are you able to figure out where our code creates an issue

@ZJay07 ZJay07 requested a review from Ishticode April 1, 2024 20:06
@ZJay07
Copy link
Contributor Author

ZJay07 commented Apr 1, 2024

Hi @Ishticode, it should work now, I'm using the tf version of sinc and cast it back to the same dtype of x which follows the characteristic of jax.numpy.sinc which mentions out – sinc(x), which has the same shape as the input.

ref: https://jax.readthedocs.io/en/latest/_autosummary/jax.numpy.sinc.html

Copy link
Contributor

@Ishticode Ishticode left a comment

Choose a reason for hiding this comment

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

seems like the right approach but now another test is failed due to this change
image
This is because the change is made in tensorflow backend, and when those two tests are ran with tensorflow backends they get value mismatches as you can see under "Combined Test Results".
NOTE: You will find the logs at https://github.com/unifyai/ivy/actions/runs/8513118977/job/23316369932?pr=28677.

@ZJay07 ZJay07 requested a review from Ishticode April 2, 2024 17:32
@ZJay07
Copy link
Contributor Author

ZJay07 commented Apr 2, 2024

Seems like ivy_tests/test_ivy/test_frontends/test_torch/test_tensor.py::test_torch_sinc_,tensorflow is still failing, I'll work on it

@ivy-leaves ivy-leaves added Paddle Paddle Backend PyTorch Frontend Developing the PyTorch Frontend, checklist triggered by commenting add_frontend_checklist labels Apr 2, 2024
Copy link
Contributor

@Ishticode Ishticode left a comment

Choose a reason for hiding this comment

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

sure

@Ishticode
Copy link
Contributor

any updates @ZJay07 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Paddle Paddle Backend PyTorch Frontend Developing the PyTorch Frontend, checklist triggered by commenting add_frontend_checklist
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix Frontend Failing Test: tensorflow - mathematical_functions.jax.numpy.sinc
3 participants