| 1487 | */ |
| 1488 | template <int out_ndim, int ndim> |
| 1489 | void 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. |
nothing calls this directly
no test coverage detected