tensorflow_serving/example/mnist_input_data.py
def extract_labels(filename, one_hot=False):
  """Extract the labels into a 1D uint8 numpy array [index]."""
  print('Extracting %s' % filename)
  with gzip.open(filename) as bytestream:
    magic = _read32(bytestream)
    if magic != 2049:
      raise ValueError(
          'Invalid magic number %d in MNIST label file: %s' %
          (magic, filename))
    num_items = _read32(bytestream)
    buf = bytestream.read(num_items)
    labels = numpy.frombuffer(buf, dtype=numpy.uint8)
    if one_hot:
      return dense_to_one_hot(labels)
    return labels
Extract the labels into a 1D uint8 numpy array [index].
Extract the labels into a 1D uint8 numpy array [index].
Extract the labels into a 1D uint8 numpy array [ index ] .
def extract_labels(filename, one_hot=False):
  print('Extracting %s' % filename)
  with gzip.open(filename) as bytestream:
    magic = _read32(bytestream)
    if magic != 2049:
      raise ValueError(
          'Invalid magic number %d in MNIST label file: %s' %
          (magic, filename))
    num_items = _read32(bytestream)
    buf = bytestream.read(num_items)
    labels = numpy.frombuffer(buf, dtype=numpy.uint8)
    if one_hot:
      return dense_to_one_hot(labels)
    return labels
def extract_labels ( filename , one_hot = False ) : print ( 'Extracting %s' % filename ) with gzip . open ( filename ) as bytestream : magic = _read32 ( bytestream ) if magic != 2049 : raise ValueError ( 'Invalid magic number %d in MNIST label file: %s' % ( magic , filename ) ) num_items = _read32 ( bytestream ) buf = bytestream . read ( num_items ) labels = numpy . frombuffer ( buf , dtype = numpy . uint8 ) if one_hot : return dense_to_one_hot ( labels ) return labels
Extract the labels into a 1D uint8 numpy array [index].
Extract the labels into a 1D uint8 numpy array [ index ] .
"""Extract the labels into a 1D uint8 numpy array [index]."""
filename
one_hot