class_docstr: Internal representation of minibatch data.
  
  Args:
      batch: batch input for `var`.
       It can be:
  
        * a pure Python structure (list of lists, ...),
        * a list of NumPy arrays or SciPy sparse CSR matrices
        * a :class:`~cntk.core.Value` object (e.g. returned by :func:`one_hot`)
      seq_starts (list of `bool`\ s or None): if None, every sequence is
       treated as a new sequence. Otherwise, it is interpreted as a list of
       Booleans that tell whether a sequence is a new sequence (`True`) or a
       continuation of the sequence in the same slot of the previous
       minibatch (`False`)
      device (:class:`~cntk.device.DeviceDescriptor`): device this value
       should be put on
class_docstr_tok: ["Internal","representation","of","minibatch","data",".","Args",":","batch",":","batch","input","for","`","var","`",".","It","can","be",":","*","a","pure","Python","structure","(","list","of","lists",",","...",")",",","*","a","list","of","NumPy","arrays","or","SciPy","sparse","CSR","matrices","*","a",":","class",":","`","~cntk.core.Value","`","object","(","e.g",".","returned","by",":","func",":","`","one_hot","`",")","seq_starts","(","list","of","`","bool","`","\\","s","or","None",")",":","if","None",",","every","sequence","is","treated","as","a","new","sequence",".","Otherwise",",","it","is","interpreted","as","a","list","of","Booleans","that","tell","whether","a","sequence","is","a","new","sequence","(","`","True","`",")","or","a","continuation","of","the","sequence","in","the","same","slot","of","the","previous","minibatch","(","`","False","`",")","device","(",":","class",":","`","~cntk.device.DeviceDescriptor","`",")",":","device","this","value","should","be","put","on"]
code: def _as_best_data_type(var, sample):
      convert_to_var_dtype = False
  
      if isinstance(sample, list):
          try:
              sample = asarray(sample, dtype=var.dtype)
          except ValueError:
              s = sample
              while isinstance(s, list) and len(s) > 0:
                  s = s[0]
              if sparse.issparse(s):
                  raise ValueError(
                      "if you provide sparse data, every "
                      "sequence must be encoded as one "
                      "csr_matrix instance. Your sequence "
                      "was: '%s'" % str(sample)
                  )
              else:
                  raise
  
          if sample.dtype != var.dtype:
              raise ValueError(
                  "could not convert sample data to " "NumPy array"
              )
  
      elif sample.dtype in (bool, np.float32, np.float64, np.float16):
          if sample.dtype != var.dtype:
              convert_to_var_dtype = True
  
      elif np.issubdtype(sample.dtype, int):
          convert_to_var_dtype = True
  
      else:
          raise ValueError(
              "only integer, bool, float32, float64 and float16 are "
              "supported, you gave %s" % sample.dtype
          )
  
      if convert_to_var_dtype:
          warnings.warn(
              'your data is of type "%s", but your input '
              'variable (uid "%s") expects "%s". Please convert '
              "your data beforehand to speed up training."
              % (sample.dtype, var.uid, str(var.dtype))
          )
          sample = sample.astype(var.dtype)
  
      return sample
  
imports: import warnings
  import numbers
  import numpy
  from scipy import sparse
  from .None import cntk_py
  from .device import use_default_device, cpu, DeviceKind
  from cntk.internal import typemap
  from cntk.internal.sanitize import sanitize_batch, _sparse_to_dense_network_cache, data_type_to_dtype
label_desc: Use image node_id 3 for calling the Value obj's underlying member method code with example usage: obj._as_best_data_type(var, sample) and returns: sample