The semantic layout of the tensor, e.g. HWC, CHW. The layout assigns meaning to the axes. It affects the way in which the data is interpreted by some operators. Image/video/volume layouts: H - height, W - width, D - depth, C - channe
(self)
| 466 | |
| 467 | @property |
| 468 | def layout(self) -> str | None: |
| 469 | """ |
| 470 | The semantic layout of the tensor, e.g. HWC, CHW. |
| 471 | |
| 472 | The layout assigns meaning to the axes. It affects the way in which the data is |
| 473 | interpreted by some operators. |
| 474 | |
| 475 | Image/video/volume layouts: |
| 476 | H - height, |
| 477 | W - width, |
| 478 | D - depth, |
| 479 | C - channels, |
| 480 | F - frames |
| 481 | |
| 482 | Audio layouts: |
| 483 | f - frequency |
| 484 | t - time |
| 485 | C - channels |
| 486 | """ |
| 487 | if self._layout is None: |
| 488 | if self._invocation_result is not None: |
| 489 | self._layout = self._invocation_result.layout |
| 490 | elif self._slice: |
| 491 | self._layout = self._slice.layout |
| 492 | elif self._batch is not None: |
| 493 | self._layout = self._batch.layout |
| 494 | else: |
| 495 | self._layout = self._storage.layout() |
| 496 | # Use "" to indicate that the layout has been checked and is empty, but still return None |
| 497 | # to avoid situations where we return a string with a length that doesn't match the number |
| 498 | # of dimensions. |
| 499 | return self._layout or None |
| 500 | |
| 501 | @property |
| 502 | def size(self) -> int: |