You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[FIX] Fix tensor concatenation to handle mixed numpy/torch arrays (#37)
### TL;DR
Fix tensor concatenation to handle mixed numpy arrays
### What changed?
Modified the `_concatenate` function in `backend_tensor.py` to properly handle cases where some tensors in the input list are numpy arrays. The previous implementation only checked the type of the first tensor, which could lead to errors when concatenating mixed tensor types. Also added an explicit error for unsupported tensor types.
### How to test?
Test concatenating a list of tensors where some elements are numpy arrays and others are not. Verify that the function correctly identifies and handles numpy arrays regardless of their position in the list.
### Why make this change?
The previous implementation had a bug where it only checked the type of the first tensor in the list, which would fail if the first tensor was not a numpy array but other tensors in the list were. This change makes the function more robust by checking if any tensor in the list is a numpy array, ensuring proper handling of mixed tensor types.
0 commit comments