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

feat: handle case for float values with int dtype specified in tf backend #27890

Merged
merged 3 commits into from
Jan 10, 2024

Conversation

Ishticode
Copy link
Contributor

Previously

import torch
import ivy
import ivy.functional.frontends.torch as torch_frontend
print(torch.tensor(0.5, dtype=torch.int64)) # works - creates tensor(0)

ivy.set_tensorflow_backend()
print(torch_frontend.tensor(0.5, dtype='int64')) # throws error

But after this the frontend torch will create ivy.frontends.torch.Tensor(0)

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.

@Ishticode Ishticode self-assigned this Jan 9, 2024
Copy link
Contributor

@vedpatwardhan vedpatwardhan left a comment

Choose a reason for hiding this comment

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

Hey @Ishticode, thanks for creating the PR 😄
I think this is something we should do in the frontends because passing in a float input and specifying the int dtype is quite strange behaviour which should be treated as framework-specific and dealt with in the frontends. What do you think?

Copy link
Contributor Author

@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.

best handled in backend bcz all frontends support in native. e.g.
jnp.array(0.5, dtype=jnp.int64) -> array(0)
np.array(0.5, dtype=np.int64) -> array(0)
😄

@Ishticode Ishticode merged commit 1b87218 into Transpile-AI:main Jan 10, 2024
85 of 141 checks passed
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.

None yet

2 participants