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

Function load_data

examples/singa_peft/examples/model/gan_utils.py:37–46  ·  view source on GitHub ↗
(filepath)

Source from the content-addressed store, hash-verified

35 print('[{}]{}'.format(t, s))
36
37def load_data(filepath):
38 with gzip.open(filepath, 'rb') as f:
39 train_set, valid_set, test_set = pickle.load(f, encoding='bytes')
40 traindata = train_set[0].astype(np.float32)
41 validdata = valid_set[0].astype(np.float32)
42 testdata = test_set[0].astype(np.float32)
43 trainlabel = train_set[1].astype(np.float32)
44 validlabel = valid_set[1].astype(np.float32)
45 testlabel = test_set[1].astype(np.float32)
46 return traindata, trainlabel, validdata, validlabel, testdata, testlabel
47
48def download_data(gzfile, url):
49 if os.path.exists(gzfile):

Callers 2

trainMethod · 0.90
trainMethod · 0.90

Calls 1

loadMethod · 0.45

Tested by

no test coverage detected