Ensure that any iterable goes through the check
@@ -77,10 +77,14 @@ def asarray(
# Give a better error message in this case. NumPy would convert this
# to an object array. TODO: This won't handle large integers in lists.
raise OverflowError("Integer out of bounds for array dtypes")
- if isinstance(obj, (list, tuple)):
+
+ try:
# Make sure that sequences containing numpy or cupy array API objects
# can be concatenated successfully. See #6367
obj = [x._array if hasattr(x, '_array') else x for x in obj]
+ except TypeError:
+ pass
+
prev_device = runtime.getDevice()
try:
runtime.setDevice(device.id)
