diff --git a/docarray/index/abstract.py b/docarray/index/abstract.py index a6eecbf185c..17da44221d8 100644 --- a/docarray/index/abstract.py +++ b/docarray/index/abstract.py @@ -854,9 +854,9 @@ def _to_numpy(self, val: Any, allow_passthrough=False) -> Any: return val.unwrap().numpy() if isinstance(val, (list, tuple)): return np.array(val) - if (torch is not None and isinstance(val, torch.Tensor)) or ( - tf is not None and isinstance(val, tf.Tensor) - ): + if torch is not None and isinstance(val, torch.Tensor): + return val.detach().numpy() + if tf is not None and isinstance(val, tf.Tensor): return val.numpy() if allow_passthrough: return val