tensorflow_serving/example/mnist_input_data.py
def read_data_sets(train_dir, fake_data=False, one_hot=False):
  """Return training, validation and testing data sets."""

  class DataSets(object):
    pass

  data_sets = DataSets()

  if fake_data:
    data_sets.train = DataSet([], [], fake_data=True, one_hot=one_hot)
    data_sets.validation = DataSet([], [], fake_data=True, one_hot=one_hot)
    data_sets.test = DataSet([], [], fake_data=True, one_hot=one_hot)
    return data_sets

  local_file = maybe_download(TRAIN_IMAGES, train_dir)
  train_images = extract_images(local_file)

  local_file = maybe_download(TRAIN_LABELS, train_dir)
  train_labels = extract_labels(local_file, one_hot=one_hot)

  local_file = maybe_download(TEST_IMAGES, train_dir)
  test_images = extract_images(local_file)

  local_file = maybe_download(TEST_LABELS, train_dir)
  test_labels = extract_labels(local_file, one_hot=one_hot)

  validation_images = train_images[:VALIDATION_SIZE]
  validation_labels = train_labels[:VALIDATION_SIZE]
  train_images = train_images[VALIDATION_SIZE:]
  train_labels = train_labels[VALIDATION_SIZE:]

  data_sets.train = DataSet(train_images, train_labels)
  data_sets.validation = DataSet(validation_images, validation_labels)
  data_sets.test = DataSet(test_images, test_labels)

  return data_sets
Return training, validation and testing data sets.
Return training, validation and testing data sets.
Return training validation and testing data sets .
def read_data_sets(train_dir, fake_data=False, one_hot=False):
  class DataSets(object):
    pass
  data_sets = DataSets()
  if fake_data:
    data_sets.train = DataSet([], [], fake_data=True, one_hot=one_hot)
    data_sets.validation = DataSet([], [], fake_data=True, one_hot=one_hot)
    data_sets.test = DataSet([], [], fake_data=True, one_hot=one_hot)
    return data_sets
  local_file = maybe_download(TRAIN_IMAGES, train_dir)
  train_images = extract_images(local_file)
  local_file = maybe_download(TRAIN_LABELS, train_dir)
  train_labels = extract_labels(local_file, one_hot=one_hot)
  local_file = maybe_download(TEST_IMAGES, train_dir)
  test_images = extract_images(local_file)
  local_file = maybe_download(TEST_LABELS, train_dir)
  test_labels = extract_labels(local_file, one_hot=one_hot)
  validation_images = train_images[:VALIDATION_SIZE]
  validation_labels = train_labels[:VALIDATION_SIZE]
  train_images = train_images[VALIDATION_SIZE:]
  train_labels = train_labels[VALIDATION_SIZE:]
  data_sets.train = DataSet(train_images, train_labels)
  data_sets.validation = DataSet(validation_images, validation_labels)
  data_sets.test = DataSet(test_images, test_labels)
  return data_sets
def read_data_sets ( train_dir , fake_data = False , one_hot = False ) : class DataSets ( object ) : pass data_sets = DataSets ( ) if fake_data : data_sets . train = DataSet ( [ ] , [ ] , fake_data = True , one_hot = one_hot ) data_sets . validation = DataSet ( [ ] , [ ] , fake_data = True , one_hot = one_hot ) data_sets . test = DataSet ( [ ] , [ ] , fake_data = True , one_hot = one_hot ) return data_sets local_file = maybe_download ( TRAIN_IMAGES , train_dir ) train_images = extract_images ( local_file ) local_file = maybe_download ( TRAIN_LABELS , train_dir ) train_labels = extract_labels ( local_file , one_hot = one_hot ) local_file = maybe_download ( TEST_IMAGES , train_dir ) test_images = extract_images ( local_file ) local_file = maybe_download ( TEST_LABELS , train_dir ) test_labels = extract_labels ( local_file , one_hot = one_hot ) validation_images = train_images [ : VALIDATION_SIZE ] validation_labels = train_labels [ : VALIDATION_SIZE ] train_images = train_images [ VALIDATION_SIZE : ] train_labels = train_labels [ VALIDATION_SIZE : ] data_sets . train = DataSet ( train_images , train_labels ) data_sets . validation = DataSet ( validation_images , validation_labels ) data_sets . test = DataSet ( test_images , test_labels ) return data_sets
Return training, validation and testing data sets.
Return training validation and testing data sets .
"""Return training, validation and testing data sets."""
train_dir
fake_data
one_hot