code: def _arrayify(X: Tensor) -> np.ndarray:
      r"""Convert a torch.Tensor (any dtype or device) to a numpy (double) array.
  
      Args:
          X: The input tensor.
  
      Returns:
          A numpy array of double dtype with the same shape and data as `X`.
      """
      return X.cpu().detach().contiguous().double().clone().numpy()
  
imports: from __future__ import annotations
  from functools import partial
  from typing import Callable, Dict, List, Optional, Tuple, Union
  import numpy
  import torch
  from botorch.exceptions.errors import CandidateGenerationError, UnsupportedError
  from scipy.optimize import Bounds
  from torch import Tensor
label_desc: Use image node_id 5 for calling a global function with example usage: _arrayify(X) and returns: X