Skip to content

Commit

Permalink
Add guards to array_interface code
Browse files Browse the repository at this point in the history
PR #1071 introduced a regression here for torch tensors, since for them,
``is_array`` is true, but ``__array_interface__`` doesn't exist.
  • Loading branch information
orausch committed Jul 31, 2022
1 parent 7506ba6 commit d4ac61e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion dace/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__')):
if dtypes.is_gpu_array(obj):
interface = obj.__cuda_array_interface__
storage = dtypes.StorageType.GPU_Global
Expand Down

0 comments on commit d4ac61e

Please sign in to comment.