class_docstr: Converter class to convert between mtf.Tensor, tf.Tensor and np.array.
docstr: Convert a numpy array to an equivalent mtf.Tensor.
docstr_tok: ["Convert","a","numpy","array","to","an","equivalent","mtf.Tensor","."]
code: def convert_np_array_to_mtf_tensor(
      self, x, dim_names=None, dtype=tf.int32
  ):
      """Convert a numpy array to an equivalent mtf.Tensor."""
      dim_sizes = x.shape
      if not dim_names:
          dim_names = [f"dim{i}" for i in range(len(dim_sizes))]
  
      dims = []
      for dim_size, dim_name in zip(dim_sizes, dim_names):
          dims.append(mtf.Dimension(dim_name, dim_size))
      shape = mtf.Shape(dims)
      x_mtf = mtf.constant(self.mesh, x, shape=shape, dtype=dtype)
      return x_mtf
  
file_path: mesh/mesh_tensorflow/test_utils.py
imports: import mesh_tensorflow
  import tensorflow.compat.v1
label_desc: Use image node_id 2 for calling the NumpyConverter obj's underlying member method code with example usage: obj.convert_np_array_to_mtf_tensor(x, dim_names, dtype) and returns: x_mtf