code: def convert_to_tensor(arr):
      tensor = torch.from_numpy(np.asarray(arr))
      if tensor.dtype == torch.double:
          tensor = tensor.float()
      return tensor
  
file_path: ray/rllib_contrib/leela_chess_zero/src/rllib_leela_chess_zero/leela_chess_zero/leela_chess_zero_model.py
imports: import numpy
  from ray.rllib.models.preprocessors import get_preprocessor
  from ray.rllib.models.torch.torch_modelv2 import TorchModelV2
  from ray.rllib.utils.annotations import override
  from ray.rllib.utils.framework import try_import_torch
  from ray.rllib.utils.typing import ModelConfigDict, TensorType
label_desc: Use image node_id 1 for calling a global function with example usage: convert_to_tensor(arr) and returns: tensor