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

Function test_file_reader_relpath

dali/test/python/reader/test_file.py:100–115  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

98
99
100def test_file_reader_relpath():
101 batch_size = 3
102 rel_root = os.path.relpath(g_root, os.getcwd())
103 fnames = [os.path.join(rel_root, f) for f in g_files]
104
105 pipe = Pipeline(batch_size, 1, 0)
106 files, labels = fn.readers.file(files=fnames, random_shuffle=True)
107 pipe.set_outputs(files, labels)
108
109 num_iters = (len(fnames) + 2 * batch_size) // batch_size
110 for i in range(num_iters):
111 out_f, out_l = pipe.run()
112 for j in range(batch_size):
113 contents = bytes(out_f.at(j)).decode("utf-8")
114 index = out_l.at(j)[0]
115 assert contents == ref_contents(fnames[index])
116
117
118def test_file_reader_relpath_file_list():

Callers

nothing calls this directly

Calls 7

set_outputsMethod · 0.95
runMethod · 0.95
PipelineClass · 0.90
ref_contentsFunction · 0.85
fileMethod · 0.80
decodeMethod · 0.45
atMethod · 0.45

Tested by

no test coverage detected