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

Function PerturbAndValidate

dali/kernels/test/block_setup_test.cc:41–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39
40template <int ndim, int channel_dim>
41void PerturbAndValidate(
42 BlockSetup<ndim, channel_dim> &setup,
43 TensorListShape<ndim + (channel_dim >= 0)> shape,
44 const TensorListShape<ndim + (channel_dim >= 0)> in_shape,
45 span<TensorShape<ndim>> sizes) {
46 constexpr int tensor_ndim = BlockSetup<ndim, channel_dim>::tensor_ndim;
47 EXPECT_NO_THROW(setup.ValidateOutputShape(shape, in_shape, sizes));
48 for (int i = 0; i < shape.num_samples(); i++) {
49 for (int d = 0; d < tensor_ndim; d++) {
50 shape.tensor_shape_span(i)[d]++;
51 EXPECT_THROW(setup.ValidateOutputShape(shape, in_shape, sizes), std::exception);
52 shape.tensor_shape_span(i)[d]--;
53 EXPECT_NO_THROW(setup.ValidateOutputShape(shape, in_shape, sizes));
54 }
55 }
56}
57
58TEST(BlockSetup, GetOutputShape_DHWC) {
59 BlockSetup<3, 3> setup; // DHWC

Callers 1

TESTFunction · 0.85

Calls 3

ValidateOutputShapeMethod · 0.80
num_samplesMethod · 0.45
tensor_shape_spanMethod · 0.45

Tested by

no test coverage detected