aboutsummaryrefslogtreecommitdiff
path: root/Utils.cpp
diff options
context:
space:
mode:
authorsurmeh01 <surabhi.mehta@arm.com>2018-07-05 12:06:04 +0100
committersurmeh01 <surabhi.mehta@arm.com>2018-07-05 12:06:04 +0100
commitdeb3bdbe028a59da0759dd7a560387d03a11d322 (patch)
tree869b7ee10d8f1f19a0861e0b552bb453330adf0a /Utils.cpp
parent49b9e100bfbb3b8da01472a0ff48b2bd92944e01 (diff)
downloadandroid-nn-driver-deb3bdbe028a59da0759dd7a560387d03a11d322.tar.gz
Release 18.05.02
Diffstat (limited to 'Utils.cpp')
-rw-r--r--Utils.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/Utils.cpp b/Utils.cpp
index 01c2719b..99912201 100644
--- a/Utils.cpp
+++ b/Utils.cpp
@@ -63,8 +63,17 @@ void* GetMemoryFromPool(DataLocation location, const std::vector<android::nn::Ru
// find the location within the pool
assert(location.poolIndex < memPools.size());
- uint8_t* memory =
- static_cast<uint8_t*>(static_cast<void*>(memPools[location.poolIndex].buffer)) + location.offset;
+ const android::nn::RunTimePoolInfo& memPool = memPools[location.poolIndex];
+
+ // Type android::nn::RunTimePoolInfo has changed between Android O and Android P, where
+ // "buffer" has been made private and must be accessed via the accessor method "getBuffer".
+#if defined(ARMNN_ANDROID_P) // Use the new Android P implementation.
+ uint8_t* memPoolBuffer = memPool.getBuffer();
+#else // Fallback to the old Android O implementation.
+ uint8_t* memPoolBuffer = memPool.buffer;
+#endif
+
+ uint8_t* memory = memPoolBuffer + location.offset;
return memory;
}
@@ -102,7 +111,7 @@ std::string GetOperandSummary(const Operand& operand)
toString(operand.type);
}
-std::string GetModelSummary(const Model& model)
+std::string GetModelSummary(const V1_0::Model& model)
{
std::stringstream result;
@@ -273,7 +282,7 @@ void DumpTensor(const std::string& dumpDir,
void ExportNetworkGraphToDotFile(const armnn::IOptimizedNetwork& optimizedNetwork,
const std::string& dumpDir,
- const Model& model)
+ const V1_0::Model& model)
{
// The dump directory must exist in advance.
if (dumpDir.empty())