MCPcopy Create free account
hub / github.com/apache/singa / load_dataset

Function load_dataset

examples/cnn/data/mnist.py:36–50  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

34
35
36def load_dataset():
37 train_x_path = '/tmp/train-images-idx3-ubyte.gz' # need to change to local disk
38 train_y_path = '/tmp/train-labels-idx1-ubyte.gz' # need to change to local disk
39 valid_x_path = '/tmp/t10k-images-idx3-ubyte.gz' # need to change to local disk
40 valid_y_path = '/tmp/t10k-labels-idx1-ubyte.gz' # need to change to local disk
41
42 train_x = read_image_file(check_dataset_exist(train_x_path)).astype(
43 np.float32)
44 train_y = read_label_file(check_dataset_exist(train_y_path)).astype(
45 np.float32)
46 valid_x = read_image_file(check_dataset_exist(valid_x_path)).astype(
47 np.float32)
48 valid_y = read_label_file(check_dataset_exist(valid_y_path)).astype(
49 np.float32)
50 return train_x, train_y, valid_x, valid_y
51
52
53def read_label_file(path):

Callers 1

loadFunction · 0.70

Calls 3

read_image_fileFunction · 0.70
check_dataset_existFunction · 0.70
read_label_fileFunction · 0.70

Tested by

no test coverage detected