Validate that filename corresponds to labels for the MNIST dataset.
(filename)
| 55 | |
| 56 | |
| 57 | def check_labels_file_header(filename): |
| 58 | """Validate that filename corresponds to labels for the MNIST dataset.""" |
| 59 | with tf.gfile.Open(filename, 'rb') as f: |
| 60 | magic = read32(f) |
| 61 | read32(f) # num_items, unused |
| 62 | if magic != 2049: |
| 63 | raise ValueError('Invalid magic number %d in MNIST file %s' % (magic, |
| 64 | f.name)) |
| 65 | |
| 66 | |
| 67 | def download(directory, filename): |