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

Use custom isnan for IPU #490

Closed
wants to merge 3 commits into from
Closed

Use custom isnan for IPU #490

wants to merge 3 commits into from

Conversation

callumm-graphcore
Copy link
Collaborator

Changelogs

  • enumerate the changes of that PR.

Checklist:

  • Was this PR discussed in an issue? It is recommended to first discuss a new feature into a GitHub issue before opening a PR.
  • Add tests to cover the fixed bug(s) or the new introduced feature(s) (if appropriate).
  • Update the API documentation is a new function is added, or an existing one is deleted.
  • Write concise and explanatory changelogs above.
  • If possible, assign one of the following labels to the PR: feature, fix or test (or ask a maintainer to do it for you).

discussion related to that PR

@@ -29,7 +30,8 @@ def forward(self, input: Tensor, target: Tensor) -> Tensor:

# Replace the nan-targets by 0 or 1. Take the value closest to the input.
# Give a weight of 0 where there are nan-targets
nan_targets = target.isnan()
#nan_targets = target.isnan()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Although the name of the class ends with IPU, this class might be used on CPU or GPU, for reproducibility, debugging, or laziness. So I would recommend creating a new function

from graphium.ipu import is_running_on_ipu
def device_is_nan(tensor):
    if is_running_on_ipu():
        return ipu_isnan(tensor)
    else:
        return torch.isnan(tensor)

@DomInvivo
Copy link
Collaborator

@callumm-graphcore this PR was also never merged. Should we close it?

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.

2 participants