docstr: Converts a `numpy` array to a `pytorch` tensor and assigns to the backend device.
docstr_tok: ["Converts","a","`","numpy","`","array","to","a","`","pytorch","`","tensor","and","assigns","to","the","backend","device","."]
code: def to_tensor(X: np.ndarray) -> torch.Tensor:
      """Converts a `numpy` array to a `pytorch` tensor and assigns to the backend device."""
      return torch.tensor(X).to(_PytorchBackend.device)
  
file_path: alibi/alibi/explainers/similarity/backends/pytorch/base.py
imports: from typing import Any, Callable, List, Optional, Union
  import numpy
  import torch
  import torch.nn
label_desc: Use image node_id 3 for calling the _PytorchBackend obj's underlying member method code with example usage: obj.to_tensor(X) and returns: torch