(path)
| 51 | |
| 52 | |
| 53 | def read_label_file(path): |
| 54 | with gzip.open(path, 'rb') as f: |
| 55 | data = f.read() |
| 56 | assert get_int(data[:4]) == 2049 |
| 57 | length = get_int(data[4:8]) |
| 58 | parsed = np.frombuffer(data, dtype=np.uint8, offset=8).reshape((length)) |
| 59 | return parsed |
| 60 | |
| 61 | |
| 62 | def get_int(b): |
no test coverage detected