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

Function test_variable_shape

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

Source from the content-addressed store, hash-verified

73
74
75def test_variable_shape():
76 num_samples = 8
77 data = [np.random.normal(size=(2, s)).astype(np.float32) for s in range(num_samples)]
78
79 @pipeline_def(batch_size=num_samples, num_threads=1)
80 def pipe():
81 encoded_npy = fn.external_source(
82 source=box_source(data), num_outputs=1, batch=False, ndim=1, dtype=DALIDataType.UINT8
83 )
84 decoded = fn.decoders.numpy(encoded_npy)
85 return decoded
86
87 p = pipe()
88 p.build()
89
90 output = p.run()
91 for i in range(num_samples):
92 test = np.asarray(output[0][i])
93 assert np.array_equal(test, data[i])
94
95
96def test_casting_decoding():

Callers

nothing calls this directly

Calls 3

pipeFunction · 0.70
buildMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected