MCPcopy Create free account
hub / github.com/RenderKit/oidn / TensorLayoutInfo getTensorLayoutInfo

Function TensorLayoutInfo getTensorLayoutInfo

core/tensor_layout.h:390–421  ·  view source on GitHub ↗

Returns information about the tensor layout

Source from the content-addressed store, hash-verified

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 {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected