aboutsummaryrefslogtreecommitdiff
path: root/test/DriverTestHelpers.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/DriverTestHelpers.hpp')
-rw-r--r--test/DriverTestHelpers.hpp82
1 files changed, 41 insertions, 41 deletions
diff --git a/test/DriverTestHelpers.hpp b/test/DriverTestHelpers.hpp
index 394720ed..4a8f607e 100644
--- a/test/DriverTestHelpers.hpp
+++ b/test/DriverTestHelpers.hpp
@@ -33,7 +33,7 @@ namespace driverTestHelpers
std::ostream& operator<<(std::ostream& os, V1_0::ErrorStatus stat);
-struct ExecutionCallback : public IExecutionCallback
+struct ExecutionCallback : public V1_0::IExecutionCallback
{
ExecutionCallback() : mNotified(false) {}
Return<void> notify(ErrorStatus status) override;
@@ -48,7 +48,7 @@ private:
bool mNotified;
};
-class PreparedModelCallback : public IPreparedModelCallback
+class PreparedModelCallback : public V1_0::IPreparedModelCallback
{
public:
PreparedModelCallback()
@@ -58,13 +58,13 @@ public:
~PreparedModelCallback() override { }
Return<void> notify(ErrorStatus status,
- const android::sp<IPreparedModel>& preparedModel) override;
+ const android::sp<V1_0::IPreparedModel>& preparedModel) override;
ErrorStatus GetErrorStatus() { return m_ErrorStatus; }
- android::sp<IPreparedModel> GetPreparedModel() { return m_PreparedModel; }
+ android::sp<V1_0::IPreparedModel> GetPreparedModel() { return m_PreparedModel; }
private:
ErrorStatus m_ErrorStatus;
- android::sp<IPreparedModel> m_PreparedModel;
+ android::sp<V1_0::IPreparedModel> m_PreparedModel;
};
hidl_memory allocateSharedMemory(int64_t size);
@@ -74,7 +74,7 @@ android::sp<IMemory> AddPoolAndGetData(uint32_t size, Request& request);
void AddPoolAndSetData(uint32_t size, Request& request, const float* data);
template<typename HalModel>
-void AddOperand(HalModel& model, const Operand& op)
+void AddOperand(HalModel& model, const V1_0::Operand& op)
{
model.operands.resize(model.operands.size() + 1);
model.operands[model.operands.size() - 1] = op;
@@ -87,11 +87,11 @@ void AddIntOperand(HalModel& model, int32_t value)
location.offset = model.operandValues.size();
location.length = sizeof(int32_t);
- Operand op = {};
- op.type = OperandType::INT32;
- op.dimensions = hidl_vec<uint32_t>{};
- op.lifetime = OperandLifeTime::CONSTANT_COPY;
- op.location = location;
+ V1_0::Operand op = {};
+ op.type = V1_0::OperandType::INT32;
+ op.dimensions = hidl_vec<uint32_t>{};
+ op.lifetime = V1_0::OperandLifeTime::CONSTANT_COPY;
+ op.location = location;
model.operandValues.resize(model.operandValues.size() + location.length);
*reinterpret_cast<int32_t*>(&model.operandValues[location.offset]) = value;
@@ -112,8 +112,8 @@ template<typename HalModel, typename T>
void AddTensorOperand(HalModel& model,
const hidl_vec<uint32_t>& dimensions,
const T* values,
- OperandType operandType = OperandType::TENSOR_FLOAT32,
- OperandLifeTime operandLifeTime = OperandLifeTime::CONSTANT_COPY)
+ V1_0::OperandType operandType = V1_0::OperandType::TENSOR_FLOAT32,
+ V1_0::OperandLifeTime operandLifeTime = V1_0::OperandLifeTime::CONSTANT_COPY)
{
uint32_t totalElements = 1;
for (uint32_t dim : dimensions)
@@ -124,16 +124,16 @@ void AddTensorOperand(HalModel& model,
DataLocation location = {};
location.length = totalElements * sizeof(T);
- if(operandLifeTime == OperandLifeTime::CONSTANT_COPY)
+ if(operandLifeTime == V1_0::OperandLifeTime::CONSTANT_COPY)
{
location.offset = model.operandValues.size();
}
- Operand op = {};
- op.type = operandType;
- op.dimensions = dimensions;
- op.lifetime = OperandLifeTime::CONSTANT_COPY;
- op.location = location;
+ V1_0::Operand op = {};
+ op.type = operandType;
+ op.dimensions = dimensions;
+ op.lifetime = V1_0::OperandLifeTime::CONSTANT_COPY;
+ op.location = location;
model.operandValues.resize(model.operandValues.size() + location.length);
for (uint32_t i = 0; i < totalElements; i++)
@@ -148,8 +148,8 @@ template<typename HalModel, typename T>
void AddTensorOperand(HalModel& model,
const hidl_vec<uint32_t>& dimensions,
const std::vector<T>& values,
- OperandType operandType = OperandType::TENSOR_FLOAT32,
- OperandLifeTime operandLifeTime = OperandLifeTime::CONSTANT_COPY)
+ V1_0::OperandType operandType = V1_0::OperandType::TENSOR_FLOAT32,
+ V1_0::OperandLifeTime operandLifeTime = V1_0::OperandLifeTime::CONSTANT_COPY)
{
AddTensorOperand<HalModel, T>(model, dimensions, values.data(), operandType, operandLifeTime);
}
@@ -157,13 +157,13 @@ void AddTensorOperand(HalModel& model,
template<typename HalModel>
void AddInputOperand(HalModel& model,
const hidl_vec<uint32_t>& dimensions,
- OperandType operandType = OperandType::TENSOR_FLOAT32)
+ V1_0::OperandType operandType = V1_0::OperandType::TENSOR_FLOAT32)
{
- Operand op = {};
- op.type = operandType;
- op.scale = operandType == OperandType::TENSOR_QUANT8_ASYMM ? 1.f / 255.f : 0.f;
- op.dimensions = dimensions;
- op.lifetime = OperandLifeTime::MODEL_INPUT;
+ V1_0::Operand op = {};
+ op.type = operandType;
+ op.scale = operandType == V1_0::OperandType::TENSOR_QUANT8_ASYMM ? 1.f / 255.f : 0.f;
+ op.dimensions = dimensions;
+ op.lifetime = V1_0::OperandLifeTime::MODEL_INPUT;
AddOperand<HalModel>(model, op);
@@ -174,13 +174,13 @@ void AddInputOperand(HalModel& model,
template<typename HalModel>
void AddOutputOperand(HalModel& model,
const hidl_vec<uint32_t>& dimensions,
- OperandType operandType = OperandType::TENSOR_FLOAT32)
+ V1_0::OperandType operandType = V1_0::OperandType::TENSOR_FLOAT32)
{
- Operand op = {};
- op.type = operandType;
- op.scale = operandType == OperandType::TENSOR_QUANT8_ASYMM ? 1.f / 255.f : 0.f;
- op.dimensions = dimensions;
- op.lifetime = OperandLifeTime::MODEL_OUTPUT;
+ V1_0::Operand op = {};
+ op.type = operandType;
+ op.scale = operandType == V1_0::OperandType::TENSOR_QUANT8_ASYMM ? 1.f / 255.f : 0.f;
+ op.dimensions = dimensions;
+ op.lifetime = V1_0::OperandLifeTime::MODEL_OUTPUT;
AddOperand<HalModel>(model, op);
@@ -188,14 +188,14 @@ void AddOutputOperand(HalModel& model,
model.outputIndexes[model.outputIndexes.size() - 1] = model.operands.size() - 1;
}
-android::sp<IPreparedModel> PrepareModelWithStatus(const V1_0::Model& model,
- armnn_driver::ArmnnDriver& driver,
- ErrorStatus& prepareStatus,
- ErrorStatus expectedStatus = ErrorStatus::NONE);
+android::sp<V1_0::IPreparedModel> PrepareModelWithStatus(const V1_0::Model& model,
+ armnn_driver::ArmnnDriver& driver,
+ ErrorStatus& prepareStatus,
+ ErrorStatus expectedStatus = ErrorStatus::NONE);
#ifdef ARMNN_ANDROID_NN_V1_1
-android::sp<IPreparedModel> PrepareModelWithStatus(const V1_1::Model& model,
+android::sp<V1_0::IPreparedModel> PrepareModelWithStatus(const V1_1::Model& model,
armnn_driver::ArmnnDriver& driver,
ErrorStatus& prepareStatus,
ErrorStatus expectedStatus = ErrorStatus::NONE);
@@ -203,18 +203,18 @@ android::sp<IPreparedModel> PrepareModelWithStatus(const V1_1::Model& model,
#endif
template<typename HalModel>
-android::sp<IPreparedModel> PrepareModel(const HalModel& model,
+android::sp<V1_0::IPreparedModel> PrepareModel(const HalModel& model,
armnn_driver::ArmnnDriver& driver)
{
ErrorStatus prepareStatus = ErrorStatus::NONE;
return PrepareModelWithStatus(model, driver, prepareStatus);
}
-ErrorStatus Execute(android::sp<IPreparedModel> preparedModel,
+ErrorStatus Execute(android::sp<V1_0::IPreparedModel> preparedModel,
const Request& request,
ErrorStatus expectedStatus = ErrorStatus::NONE);
-android::sp<ExecutionCallback> ExecuteNoWait(android::sp<IPreparedModel> preparedModel,
+android::sp<ExecutionCallback> ExecuteNoWait(android::sp<V1_0::IPreparedModel> preparedModel,
const Request& request);
} // namespace driverTestHelpers