MCPcopy Create free account
hub / github.com/NVIDIA/DALI / leave_only_N

Function leave_only_N

dali/test/python/reader/test_index.py:130–136  ·  view source on GitHub ↗
(src, dst, n)

Source from the content-addressed store, hash-verified

128 idx_file = os.path.join(idx_files_dir.name, recordio_idx)
129
130 def leave_only_N(src, dst, n):
131 with open(src, "r") as tmp_f:
132 with open(dst, "w") as f:
133 for i, x in enumerate(tmp_f):
134 if i == n:
135 break
136 f.write(x)
137
138 leave_only_N(tfrecord_idx, idx_file, num_samples)
139

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected