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

Function calculate_pointers

include/dali/core/tensor_shape.h:1048–1061  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1046 */
1047template <int sample_ndim, typename T>
1048void calculate_pointers(std::vector<T*> &pointers, T *base,
1049 const TensorListShape<sample_ndim> &tls) {
1050 pointers.resize(tls.size());
1051 if (base != nullptr) {
1052 pointers[0] = base;
1053 for (int i = 0; i < tls.size() - 1; i++) {
1054 auto sample_shape_span = tls.tensor_shape_span(i);
1055 pointers[i + 1] = pointers[i] + volume(sample_shape_span);
1056 }
1057 } else {
1058 for (auto &ptr : pointers)
1059 ptr = nullptr;
1060 }
1061}
1062
1063/**
1064 * @brief Calculate pointers for Tensors stored in contigous buffer whose shapes

Callers 3

TESTFunction · 0.85
set_contiguous_dataMethod · 0.85
TensorListViewBaseMethod · 0.85

Calls 4

volumeFunction · 0.85
resizeMethod · 0.45
sizeMethod · 0.45
tensor_shape_spanMethod · 0.45

Tested by 1

TESTFunction · 0.68