Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Checks for inconsistent device types #272

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

Conversation

jwallwork23
Copy link
Contributor

@jwallwork23 jwallwork23 commented Jan 30, 2025

Closes #269.

This PR adds checks that overloaded operators are only applied to tensors that have the same device type.

It's sufficient to add the checks in the assignment operator and the binary operators as the unary operators will go through the assignment anyway.

The PR also adds checks that tensors have been constructed before they are interrogated. Related fix in the autograd example - the output tensor Q wasn't set up so didn't have a device type yet.

Questions:

  • Do we also need to check the device indices are consistent?
  • And what about data types?
  • Can we add pFUnit unit tests that check these errors are raised as expected?

@jwallwork23 jwallwork23 added bug Something isn't working autograd Tasks towards the online training / automatic differentiation feature testing Related to FTorch testing gpu Related to buiding and running on GPU labels Jan 30, 2025
@jwallwork23 jwallwork23 self-assigned this Jan 30, 2025
@jwallwork23 jwallwork23 changed the title 269 tensor op different device error Checks for inconsistent device types Jan 30, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
autograd Tasks towards the online training / automatic differentiation feature bug Something isn't working gpu Related to buiding and running on GPU testing Related to FTorch testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Raise error if overloaded operator applied to tensors on different devices
1 participant