MCPcopy Index your code
hub / github.com/tensorpack/tensorpack / read

Method read

examples/OpticalFlow/helper.py:21–31  ·  view source on GitHub ↗
(file)

Source from the content-addressed store, hash-verified

19
20 @staticmethod
21 def read(file):
22 # https://stackoverflow.com/a/44906777/7443104
23 with open(file, 'rb') as f:
24 magic = np.fromfile(f, np.float32, count=1)
25 if 202021.25 != magic:
26 raise Exception('Magic number incorrect. Invalid .flo file')
27 else:
28 w = np.fromfile(f, np.int32, count=1)[0]
29 h = np.fromfile(f, np.int32, count=1)[0]
30 data = np.fromfile(f, np.float32, count=2 * w * h)
31 return np.resize(data, (h, w, 2))
32
33 def _construct_wheel(self):
34 k = 0

Callers 15

setup.pyFile · 0.80
get_per_pixel_meanMethod · 0.80
_read32Function · 0.80
extract_imagesFunction · 0.80
extract_labelsFunction · 0.80
__init__Method · 0.80
_read_wordsFunction · 0.80
applyFunction · 0.80
__iter__Method · 0.80
helper.pyFile · 0.80
get_dataFunction · 0.80
get_featureFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected