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

Function get_expected_layout

dali/test/python/operator_2/test_reduce.py:113–123  ·  view source on GitHub ↗
(in_layout, axes, keep_dims)

Source from the content-addressed store, hash-verified

111
112
113def get_expected_layout(in_layout, axes, keep_dims):
114 in_layout = in_layout or ""
115 if keep_dims or not in_layout:
116 return in_layout
117 if axes is None:
118 return ""
119 if isinstance(axes, int):
120 axes = [axes]
121 ndim = len(in_layout)
122 axes = [(axis + ndim) % ndim for axis in axes]
123 return "".join(c for i, c in enumerate(in_layout) if i not in axes)
124
125
126def check_layout(tensor, in_layout, axes, keep_dims):

Callers 1

check_layoutFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected