code: def validate_tensor(tensor):
      if hasattr(tensor, "to_tensor"):
          tensor = tensor.to_tensor()
      else:
          tensor = mt.tensor(tensor)
      if tensor.ndim != 2:
          raise ValueError("Input tensor should be 2-d")
      return tensor
  
file_path: mars/mars/learn/proxima/core.py
imports: import numpy
  from ...None import tensor
  from ...tensor.merge import TensorConcatenate
  from ...tensor.indexing import TensorSlice
label_desc: Use image node_id 3 for calling a global function with example usage: validate_tensor(tensor) and returns: tensor