| 52 | |
| 53 | |
| 54 | def test_fortran_decoding(): |
| 55 | num_samples = 8 |
| 56 | data = [np.array(np.random.normal(size=(2, s)), order="F") for s in range(num_samples)] |
| 57 | |
| 58 | @pipeline_def(batch_size=1, num_threads=1) |
| 59 | def pipe(): |
| 60 | encoded_npy = fn.external_source( |
| 61 | source=box_source(data), num_outputs=1, batch=False, ndim=1, dtype=DALIDataType.UINT8 |
| 62 | ) |
| 63 | decoded = fn.decoders.numpy(encoded_npy) |
| 64 | return decoded |
| 65 | |
| 66 | p = pipe() |
| 67 | p.build() |
| 68 | |
| 69 | for i in range(num_samples): |
| 70 | output = p.run() |
| 71 | test = np.asarray(output[0][0]) |
| 72 | assert np.array_equal(test, data[i]) |
| 73 | |
| 74 | |
| 75 | def test_variable_shape(): |