| 450 | } |
| 451 | |
| 452 | armnn::TensorInfo ToTensorInfo(TfLiteParserImpl::TensorRawPtr tensorPtr, |
| 453 | const std::vector<unsigned int>& shape, |
| 454 | const bool outputTensor = false) |
| 455 | { |
| 456 | armnn::DataType type; |
| 457 | CHECK_TENSOR_PTR(tensorPtr); |
| 458 | |
| 459 | switch (tensorPtr->type) |
| 460 | { |
| 461 | case tflite::TensorType_UINT8: |
| 462 | type = armnn::DataType::QAsymmU8; |
| 463 | break; |
| 464 | case tflite::TensorType_FLOAT32: |
| 465 | type = armnn::DataType::Float32; |
| 466 | break; |
| 467 | case tflite::TensorType_FLOAT16: |
| 468 | type = armnn::DataType::Float16; |
| 469 | break; |
| 470 | case tflite::TensorType_INT8: |
| 471 | if (tensorPtr->quantization->zero_point.size() == 1) |
| 472 | { |
| 473 | // Per-tensor |
| 474 | type = armnn::DataType::QAsymmS8; |
| 475 | } |
| 476 | else |
| 477 | { |
| 478 | // Per-channel |
| 479 | type = armnn::DataType::QSymmS8; |
| 480 | } |
| 481 | break; |
| 482 | case tflite::TensorType_INT16: |
| 483 | type = armnn::DataType::QSymmS16; |
| 484 | break; |
| 485 | case tflite::TensorType_INT32: |
| 486 | type = armnn::DataType::Signed32; |
| 487 | break; |
| 488 | case tflite::TensorType_INT64: |
| 489 | type = armnn::DataType::Signed64; |
| 490 | break; |
| 491 | case tflite::TensorType_BOOL: |
| 492 | type = armnn::DataType::Boolean; |
| 493 | break; |
| 494 | default: |
| 495 | { |
| 496 | CheckLocation location = CHECK_LOCATION(); |
| 497 | throw ParseException( |
| 498 | fmt::format("Unsupported data type {} = {} for tensor: {}. {}", |
| 499 | tensorPtr->type, |
| 500 | tflite::EnumNameTensorType(tensorPtr->type), |
| 501 | tensorPtr->name, |
| 502 | location.AsString())); |
| 503 | } |
| 504 | } |
| 505 | TensorShape tensorShape; |
| 506 | |
| 507 | std::vector<unsigned int> safeShape = shape; |
| 508 | if (shape.size() == 0) |
| 509 | { |
no test coverage detected