diff options
author | TreeHugger Robot <treehugger-gerrit@google.com> | 2019-03-06 14:37:09 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2019-03-06 14:37:09 +0000 |
commit | 852453d2ba89fdfb6aeb1f86c28b957c4c931e3e (patch) | |
tree | 79bcac78be9eca91231557d2e7bbfc0b967d4eb4 /nn/runtime/Manager.cpp | |
parent | dc5f0c039042c0e7856f3ee464123cced619ac34 (diff) | |
parent | 1b7ef17ff89fcbaaa2b7f0fb7a6682165809d3a1 (diff) | |
download | ml-852453d2ba89fdfb6aeb1f86c28b957c4c931e3e.tar.gz |
Merge "Add a centralized runtime extension information store"
Diffstat (limited to 'nn/runtime/Manager.cpp')
-rw-r--r-- | nn/runtime/Manager.cpp | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/nn/runtime/Manager.cpp b/nn/runtime/Manager.cpp index 420e9978d..43de68c5a 100644 --- a/nn/runtime/Manager.cpp +++ b/nn/runtime/Manager.cpp @@ -37,40 +37,6 @@ using HidlToken = hidl_array<uint8_t, ANEURALNETWORKS_BYTE_SIZE_OF_CACHE_TOKEN>; namespace android { namespace nn { -uint32_t Device::getSizeOfData(const Operand& operand, - const std::map<std::string, uint16_t>& extensionNameToPrefix) const { - if (!isExtensionOperandType(operand.type)) { - return sizeOfData(operand); - } - - // A slow naive implementation. - // TODO(b/123178734): Speed it up. - uint32_t operandType = static_cast<uint32_t>(operand.type); - uint8_t kLowBitsType = static_cast<uint8_t>(Model::ExtensionTypeEncoding::LOW_BITS_TYPE); - uint16_t prefix = operandType >> kLowBitsType; - uint16_t typeWithinExtension = operandType & ((1 << kLowBitsType) - 1); - for (const Extension& extension : getSupportedExtensions()) { - if (extensionNameToPrefix.at(extension.name) != prefix) { - continue; - } - for (auto& extensionOperandType : extension.operandTypes) { - if (extensionOperandType.type == typeWithinExtension) { - uint32_t numElements = 1; - if (extensionOperandType.isTensor) { - for (auto dimension : operand.dimensions) { - numElements *= dimension; - } - } - return numElements * extensionOperandType.byteSize; - } - } - } - - CHECK(false) << "Cannot determine the size of extension operand type " - << toString(operand.type); - return 0; -} - // A Device with actual underlying driver class DriverDevice : public Device { DISALLOW_IMPLICIT_CONSTRUCTORS(DriverDevice); |