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

Function test_raise_different_dims

dali/test/python/decoder/test_numpy.py:121–135  ·  view source on GitHub ↗
(batch_size)

Source from the content-addressed store, hash-verified

119@raises(RuntimeError, "All samples in the dataset must have the same number of dimensions")
120@params(1, 2)
121def test_raise_different_dims(batch_size):
122 data = [np.empty(shape, dtype=np.float32) for shape in [(2, 3), (2, 3), (2, 3, 4), (2, 3)]]
123
124 @pipeline_def(batch_size=batch_size, num_threads=1)
125 def pipe():
126 encoded_npy = fn.external_source(
127 source=box_source(data), num_outputs=1, batch=False, ndim=1, dtype=DALIDataType.UINT8
128 )
129 decoded = fn.decoders.numpy(encoded_npy)
130 return decoded
131
132 p = pipe()
133 p.build()
134 for _ in range(len(data) // batch_size):
135 p.run()
136
137
138@raises(RuntimeError, "Got bad magic string for numpy header")

Callers

nothing calls this directly

Calls 4

pipeFunction · 0.70
emptyMethod · 0.45
buildMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected