| 294 | } |
| 295 | |
| 296 | Sme2ShapeProfile BuildSme2ShapeProfile(const Graph& graph, bool reduceFp32ToFp16) |
| 297 | { |
| 298 | Sme2ShapeProfile profile; |
| 299 | profile.m_HasFp16 = reduceFp32ToFp16; |
| 300 | |
| 301 | for (const Layer* layer : graph) |
| 302 | { |
| 303 | switch (layer->GetType()) |
| 304 | { |
| 305 | case LayerType::Convolution2d: |
| 306 | RecordConvolution2d(profile, *layer); |
| 307 | break; |
| 308 | case LayerType::FullyConnected: |
| 309 | RecordFullyConnected(profile, *layer); |
| 310 | break; |
| 311 | case LayerType::BatchMatMul: |
| 312 | RecordBatchMatMul(profile, *layer); |
| 313 | break; |
| 314 | case LayerType::DepthwiseConvolution2d: |
| 315 | RecordDepthwiseConvolution2d(profile, *layer); |
| 316 | break; |
| 317 | default: |
| 318 | for (unsigned int i = 0; i < layer->GetNumInputSlots(); ++i) |
| 319 | { |
| 320 | if (layer->GetInputSlot(i).IsTensorInfoSet()) |
| 321 | { |
| 322 | RecordTensorType(profile, layer->GetInputSlot(i).GetTensorInfo()); |
| 323 | } |
| 324 | } |
| 325 | for (unsigned int i = 0; i < layer->GetNumOutputSlots(); ++i) |
| 326 | { |
| 327 | if (layer->GetOutputSlot(i).IsTensorInfoSet()) |
| 328 | { |
| 329 | RecordTensorType(profile, layer->GetOutputSlot(i).GetTensorInfo()); |
| 330 | } |
| 331 | } |
| 332 | break; |
| 333 | } |
| 334 | } |
| 335 | |
| 336 | return profile; |
| 337 | } |
| 338 | |
| 339 | unsigned int CapWorkerCount(unsigned int workers, unsigned int cap) |
| 340 | { |
no test coverage detected