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

Function malformed_source

dali/test/python/decoder/test_numpy.py:197–207  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

195@params(True, False)
196def test_malformed_data(truncate):
197 def malformed_source():
198 data = np.empty(100, dtype=np.uint8)
199 buff = io.BytesIO()
200 np.save(buff, data, allow_pickle=False)
201 buff.seek(0)
202 raw = np.frombuffer(buff.read(), dtype=np.uint8)
203 if truncate:
204 raw = raw[:-100] # Truncate the data
205 else:
206 raw = np.concatenate((raw, np.empty(100, dtype=np.uint8))) # Add extra data
207 yield (raw,)
208
209 @pipeline_def(batch_size=1, num_threads=1)
210 def pipe():

Callers 1

pipeFunction · 0.85

Calls 4

seekMethod · 0.80
readMethod · 0.80
emptyMethod · 0.45
saveMethod · 0.45

Tested by

no test coverage detected