code: def get_tensor(x, dtype=None):
      """
      Input:
          - x: list or a sequence
          - dtype: target data type of the elements in tensor [optional]
                   It will be inferred automatically if not provided.
      Output:
          Tensor given a list or a sequence.
          If the input is None, it returns None
          If the input is a tensor it returns the tensor.
          If type is provides the output Tensor will have that type
      """
      if x is None:
          return None
  
      if not isinstance(x, torch.Tensor):
          x = torch.tensor(x)
  
      if dtype is not None:
          x = x.type(dtype)
  
      return x
  
file_path: ReAgent/reagent/evaluation/evaluator.py
imports: import logging
  from collections import Counter
  from typing import Dict, List, Optional
  import torch
  import torch.nn.functional
  from reagent.core.tracker import observable
  from reagent.evaluation.cpe import CpeDetails, CpeEstimateSet
  from reagent.evaluation.doubly_robust_estimator import DoublyRobustEstimator
  from reagent.evaluation.evaluation_data_page import EvaluationDataPage
  from reagent.evaluation.sequential_doubly_robust_estimator import SequentialDoublyRobustEstimator
  from reagent.evaluation.weighted_sequential_doubly_robust_estimator import WeightedSequentialDoublyRobustEstimator
label_desc: Use image node_id 1 for calling a global function with example usage: get_tensor(x, dtype) and returns: x, None