MCPcopy Create free account
hub / github.com/NVIDIA/TensorRT / load_mnist_labels

Function load_mnist_labels

samples/python/scripts/download_mnist_pgms.py:39–44  ·  view source on GitHub ↗
(buffer)

Source from the content-addressed store, hash-verified

37
38# Returns a list of length num_images
39def load_mnist_labels(buffer):
40 raw_buf = np.fromstring(buffer, dtype=np.uint8)
41 # Make sure the magic number is what we expect
42 assert raw_buf[0:4].view(">i4")[0] == 2049
43 num_labels = raw_buf[4:8].view(">i4")[0]
44 return list(raw_buf[8:].astype(np.int32).reshape(num_labels))
45
46def main():
47 parser = argparse.ArgumentParser(description="Extracts 10 PGM files from the MNIST dataset", formatter_class=argparse.ArgumentDefaultsHelpFormatter)

Callers 1

mainFunction · 0.85

Calls 1

viewMethod · 0.80

Tested by

no test coverage detected