def _convert_tensor_to_numpy(output: Union[FloatTensor, Tensor]) -> ndarray:
    """
    A function that convert tensors to numpy arrays
    """
    if isinstance(output, (torch.Tensor, torch.FloatTensor)):
        return output.to('cpu').detach().numpy()
    elif isinstance(output, ndarray):
        return output
    else:
        raise ValueError(f"Marqo received an unexpected output type=`{type(output).__name__}`from encode function.")

    A function that convert tensors to numpy arrays
    
src/marqo/s2_inference/s2_inference.py