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

Function sample_range

include/dali/core/tensor_shape.h:1489–1501  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1487 */
1488template <int out_ndim, int ndim>
1489void sample_range(TensorListShape<out_ndim> &out, const TensorListShape<ndim> &in,
1490 int begin, int end, int step = 1) {
1491 detail::check_compatible_ndim<out_ndim, ndim>();
1492 assert(begin >= 0 && begin <= in.num_samples());
1493 assert(end >= begin && end <= in.num_samples());
1494
1495 int nsamples = div_ceil(end - begin, step);
1496 out.resize(nsamples, in.sample_dim());
1497
1498 for (int i = begin, j = 0; j < nsamples; i += step, j++) {
1499 out.set_tensor_shape(j, in.tensor_shape_span(i));
1500 }
1501}
1502
1503/**
1504 * Returns a (strided) range of sample shapes as a new TensorListShape.

Callers

nothing calls this directly

Calls 6

div_ceilFunction · 0.85
set_tensor_shapeMethod · 0.80
num_samplesMethod · 0.45
resizeMethod · 0.45
sample_dimMethod · 0.45
tensor_shape_spanMethod · 0.45

Tested by

no test coverage detected