aboutsummaryrefslogtreecommitdiff
path: root/tests/InferenceModel.hpp
diff options
context:
space:
mode:
authorNarumol Prangnawarat <narumol.prangnawarat@arm.com>2020-03-24 13:54:05 +0000
committerJim Flynn <jim.flynn@arm.com>2020-03-24 16:45:36 +0000
commitd8cc8116f2deea11ad7aff9218a2e103062a7daf (patch)
tree63ca615ca9d5f8a1655f560518fc65b662d65e51 /tests/InferenceModel.hpp
parentb6a402f46231688f7684dcb8c8e4ef5f4579b011 (diff)
downloadarmnn-d8cc8116f2deea11ad7aff9218a2e103062a7daf.tar.gz
IVGCVSW-4521 Add bf16-turbo-mode option to ExecuteNetwork
Signed-off-by: Narumol Prangnawarat <narumol.prangnawarat@arm.com> Change-Id: I57ec47adf98680254fa481fb91d5a98dea8f032e
Diffstat (limited to 'tests/InferenceModel.hpp')
-rw-r--r--tests/InferenceModel.hpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/InferenceModel.hpp b/tests/InferenceModel.hpp
index 50b1607743..711f7687b0 100644
--- a/tests/InferenceModel.hpp
+++ b/tests/InferenceModel.hpp
@@ -91,6 +91,7 @@ struct Params
bool m_IsModelBinary;
bool m_VisualizePostOptimizationModel;
bool m_EnableFp16TurboMode;
+ bool m_EnableBf16TurboMode;
bool m_PrintIntermediateLayers;
bool m_ParseUnsupported;
@@ -100,6 +101,7 @@ struct Params
, m_IsModelBinary(true)
, m_VisualizePostOptimizationModel(false)
, m_EnableFp16TurboMode(false)
+ , m_EnableBf16TurboMode(false)
, m_PrintIntermediateLayers(false)
, m_ParseUnsupported(false)
{}
@@ -328,6 +330,7 @@ public:
std::string m_DynamicBackendsPath;
bool m_VisualizePostOptimizationModel;
bool m_EnableFp16TurboMode;
+ bool m_EnableBf16TurboMode;
std::string m_Labels;
std::vector<armnn::BackendId> GetComputeDevicesAsBackendIds()
@@ -365,7 +368,10 @@ public:
"The file will have the same name as the model with the .dot extention.")
("fp16-turbo-mode", po::value<bool>(&options.m_EnableFp16TurboMode)->default_value(false),
"If this option is enabled FP32 layers, weights and biases will be converted "
- "to FP16 where the backend supports it.");
+ "to FP16 where the backend supports it.")
+ ("bf16-turbo-mode", po::value<bool>(&options.m_EnableBf16TurboMode)->default_value(false),
+ "If this option is enabled FP32 layers, weights and biases will be converted "
+ "to BF16 where the backend supports it.");
}
InferenceModel(const Params& params,
@@ -401,6 +407,7 @@ public:
armnn::OptimizerOptions options;
options.m_ReduceFp32ToFp16 = params.m_EnableFp16TurboMode;
+ options.m_ReduceFp32ToBf16 = params.m_EnableBf16TurboMode;
options.m_Debug = params.m_PrintIntermediateLayers;
optNet = armnn::Optimize(*network, params.m_ComputeDevices, m_Runtime->GetDeviceSpec(), options);