| 73 | } |
| 74 | |
| 75 | void Tensor::dump(const std::string& filenamePrefix) |
| 76 | { |
| 77 | if (dataType == DataType::Float32 && layout == TensorLayout::chw) |
| 78 | dumpImpl<float, TensorLayout::chw>(filenamePrefix); |
| 79 | else if (dataType == DataType::Float32 && layout == TensorLayout::Chw8c) |
| 80 | dumpImpl<float, TensorLayout::Chw8c>(filenamePrefix); |
| 81 | else if (dataType == DataType::Float32 && layout == TensorLayout::Chw16c) |
| 82 | dumpImpl<float, TensorLayout::Chw16c>(filenamePrefix); |
| 83 | else if (dataType == DataType::Float16 && layout == TensorLayout::chw) |
| 84 | dumpImpl<half, TensorLayout::chw>(filenamePrefix); |
| 85 | else if (dataType == DataType::Float16 && layout == TensorLayout::Chw16c) |
| 86 | dumpImpl<half, TensorLayout::Chw16c>(filenamePrefix); |
| 87 | else if (dataType == DataType::Float16 && layout == TensorLayout::hwc) |
| 88 | dumpImpl<half, TensorLayout::hwc>(filenamePrefix); |
| 89 | else |
| 90 | throw std::runtime_error("tensor dump not implemented"); |
| 91 | } |
| 92 | |
| 93 | template<typename T, TensorLayout accessorLayout> |
| 94 | void Tensor::dumpImpl(const std::string& filenamePrefix) |