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

Function SetLayout

dali/python/backend_impl.cc:240–257  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

238
239template <typename Backend>
240void SetLayout(
241 Tensor<Backend> &t,
242 const std::optional<std::string> &layout_str,
243 bool clear_if_none = true) {
244 if (layout_str && !layout_str->empty()) {
245 TensorLayout layout = *layout_str;
246 if (t.ndim() != layout.ndim()) {
247 throw py::value_error(make_string(
248 "A non-empty layout must have the same number of dimensions as the "
249 "number of dimensions of the Tensor.\n"
250 "Got: ", layout.ndim(), " (", layout, ")\n",
251 "Expected: ", t.ndim(), "."));
252 }
253 t.SetLayout(layout);
254 } else if (clear_if_none) {
255 t.SetLayout({});
256 }
257}
258
259template <typename Backend>
260void SetLayout(

Callers 12

FillTensorFromDlPackFunction · 0.70
FillTensorFromCudaArrayFunction · 0.70
ExposeTensorFunction · 0.70
ExposeTensorListCPUFunction · 0.70
ExposeTesorListGPUFunction · 0.70
SqueezeMethod · 0.50
SetupLikeImplFunction · 0.50
ResizeMethod · 0.50
CopyMethod · 0.50
ShareDataMethod · 0.50

Calls 5

make_stringFunction · 0.50
emptyMethod · 0.45
ndimMethod · 0.45
SetLayoutMethod · 0.45
sample_dimMethod · 0.45

Tested by

no test coverage detected