Skip to content

Commit

Permalink
Fix undefined AllowFp16 in Android 27
Browse files Browse the repository at this point in the history
  • Loading branch information
daquexian committed May 23, 2019
1 parent f2fd69a commit 7e86fd8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 0 additions & 2 deletions dnnlibrary/include/ModelBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,7 @@ class ModelBuilder {
const std::string &input1_name, const std::string &input2_name,
const std::string &output_name,
const std::optional<QuantInfo> &output_quant_info = std::nullopt);
#if __ANDROID_API__ >= __ANDROID_API_P__
ModelBuilder &AllowFp16(const bool allowed);
#endif
ModelBuilder &AddOutput(const std::string &name);
std::unique_ptr<Model> Compile(uint32_t preference);
IndexSeq GetInputIndexes();
Expand Down
6 changes: 4 additions & 2 deletions dnnlibrary/src/ModelBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -938,10 +938,12 @@ ModelBuilder &ModelBuilder::AddOutput(const std::string &name) {
return *this;
}

#if __ANDROID_API__ >= __ANDROID_API_P__
ModelBuilder &ModelBuilder::AllowFp16(const bool allowed) {
#if __ANDROID_API__ >= __ANDROID_API_P__
ANeuralNetworksModel_relaxComputationFloat32toFloat16(dnn_model_->model_,
allowed);
#else
(void) allowed;
#endif
return *this;
}
#endif

0 comments on commit 7e86fd8

Please sign in to comment.