Returns information about the tensor layout
| 388 | |
| 389 | // Returns information about the tensor layout |
| 390 | oidn_inline TensorLayoutInfo getTensorLayoutInfo(TensorLayout layout) |
| 391 | { |
| 392 | switch (layout) |
| 393 | { |
| 394 | case TensorLayout::x: |
| 395 | return {1, 1}; |
| 396 | case TensorLayout::chw: |
| 397 | case TensorLayout::hwc: |
| 398 | return {3, 1}; |
| 399 | case TensorLayout::Chw8c: |
| 400 | return {3, 8}; |
| 401 | case TensorLayout::Chw16c: |
| 402 | return {3, 16}; |
| 403 | case TensorLayout::Chw32c: |
| 404 | return {3, 32}; |
| 405 | case TensorLayout::oihw: |
| 406 | case TensorLayout::ohwi: |
| 407 | return {4, 1}; |
| 408 | case TensorLayout::IOhw8i8o: |
| 409 | case TensorLayout::OIhw8i8o: |
| 410 | return {4, 8}; |
| 411 | case TensorLayout::IOhw16i16o: |
| 412 | case TensorLayout::OIhw16i16o: |
| 413 | case TensorLayout::OIhw2o8i8o2i: |
| 414 | case TensorLayout::OIhw8i16o2i: |
| 415 | return {4, 16}; |
| 416 | case TensorLayout::OIhw2o16i16o2i: |
| 417 | return {4, 32}; |
| 418 | default: |
| 419 | throw std::invalid_argument("invalid tensor layout"); |
| 420 | } |
| 421 | } |
| 422 | |
| 423 | inline std::ostream& operator <<(std::ostream& sm, TensorLayout layout) |
| 424 | { |
nothing calls this directly
no outgoing calls
no test coverage detected