bool ANeuralNetworksExecution::compareDataType(const ANeuralNetworksOperandType *type,
const neurun::model::OperandIndex index) noexcept
{
- const auto operand_type = _execution->model().operands.at(index).typeInfo();
- const auto typeInfo = NNAPIConvert::getTypeInfo(type);
-
- if (operand_type != typeInfo)
+ try
+ {
+ const auto operand_type = _execution->model().operands.at(index).typeInfo();
+ const auto typeInfo = NNAPIConvert::getTypeInfo(type);
+
+ if (operand_type != typeInfo)
+ {
+ // Data type mismatch
+ return false;
+ }
+ }
+ catch (const std::exception &e)
{
- // Data type mismatch
+ VERBOSE(EXCEPTION) << e.what() << std::endl;
+
return false;
}
size_t ANeuralNetworksExecution::getOperandSize(const neurun::model::OperandIndex index) noexcept
{
- return _execution->model().operands.at(index).operandSize();
+ try
+ {
+ return _execution->model().operands.at(index).operandSize();
+ }
+ catch (const std::exception &e)
+ {
+ VERBOSE(EXCEPTION) << e.what() << std::endl;
+
+ return 0;
+ }
}
bool ANeuralNetworksExecution::setInput(uint32_t index, const ANeuralNetworksOperandType *type,
size_t ANeuralNetworksModel::operandSize(uint32_t index) noexcept
{
- return _model->operands.at(neurun::model::OperandIndex{index}).operandSize();
+ try
+ {
+ return _model->operands.at(neurun::model::OperandIndex{index}).operandSize();
+ }
+ catch (const std::exception &e)
+ {
+ VERBOSE(EXCEPTION) << e.what() << '\n';
+
+ return 0;
+ }
}
bool ANeuralNetworksModel::isUsageSet(uint32_t index) noexcept