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

Set storage type for torch tensors when creating data descriptors #1075

Merged
merged 2 commits into from
Jul 31, 2022

Conversation

orausch
Copy link
Collaborator

@orausch orausch commented Jul 31, 2022

Previously the storage of torch tensors was ignored. Also fixes a regression introduced in #1071.

Previously the storage of torch tensors was ignored
PR #1071 introduced a regression here for torch tensors, since for them,
``is_array`` is true, but ``__array_interface__`` doesn't exist.
orausch added a commit that referenced this pull request Jul 31, 2022
@@ -33,7 +33,7 @@ def create_datadescriptor(obj, no_custom_desc=False):
return obj.__descriptor__()
elif not no_custom_desc and hasattr(obj, 'descriptor'):
return obj.descriptor
elif dtypes.is_array(obj):
elif dtypes.is_array(obj) and (hasattr(obj, '__array_interface__') or hasattr(obj, '__cuda_array_interface__')):
Copy link
Collaborator

Choose a reason for hiding this comment

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

What regression does this cause?

Copy link
Collaborator Author

@orausch orausch Jul 31, 2022

Choose a reason for hiding this comment

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

For torch tensors is_array is true, but __array_interface__ doesn't exist. Thus this branch gets chosen but it fails later when __array_interface__ is accessed.

@tbennun tbennun enabled auto-merge July 31, 2022 13:53
@tbennun tbennun merged commit a1d207f into master Jul 31, 2022
@orausch orausch deleted the fix-cuda-torch-tensors branch August 1, 2022 08:30
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