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

Function load_train_data

examples/singa_peft/examples/data/cifar10.py:44–55  ·  view source on GitHub ↗
(dir_path='/scratch/snx3000/lyongbin/singa_my/cifar10_log/cifar-10-batches-py', num_batches=5)

Source from the content-addressed store, hash-verified

42
43#def load_train_data(dir_path='/scratch1/07801/nusbin20/gordon-bell/cifar-10-batches-py', num_batches=5):
44def load_train_data(dir_path='/scratch/snx3000/lyongbin/singa_my/cifar10_log/cifar-10-batches-py', num_batches=5):
45 labels = []
46 batchsize = 10000
47 images = np.empty((num_batches * batchsize, 3, 32, 32), dtype=np.uint8)
48 for did in range(1, num_batches + 1):
49 fname_train_data = dir_path + "/data_batch_{}".format(did)
50 image, label = load_dataset(check_dataset_exist(fname_train_data))
51 images[(did - 1) * batchsize:did * batchsize] = image
52 labels.extend(label)
53 images = np.array(images, dtype=np.float32)
54 labels = np.array(labels, dtype=np.int32)
55 return images, labels
56
57
58#def load_test_data(dir_path='/scratch1/07801/nusbin20/gordon-bell/cifar-10-batches-py'):

Callers 1

loadFunction · 0.70

Calls 3

emptyMethod · 0.80
load_datasetFunction · 0.70
check_dataset_existFunction · 0.70

Tested by

no test coverage detected