diff --git a/cmake/utils/FindEthosN.cmake b/cmake/utils/FindEthosN.cmake index d33b55f0c7a9..26d00a462b39 100644 --- a/cmake/utils/FindEthosN.cmake +++ b/cmake/utils/FindEthosN.cmake @@ -59,6 +59,7 @@ macro(find_ethosn use_ethosn) find_library(ETHOSN_COMPILER_LIBRARY NAMES EthosNSupport) set(ETHOSN_PACKAGE_VERSION "0.1.1") + set(ETHOSN_DEFINITIONS -DETHOSN_API_VERSION=${USE_ETHOSN_API_VERSION}) if(${USE_ETHOSN_HW} MATCHES ${IS_TRUE_PATTERN}) # Runtime hardware support @@ -70,7 +71,7 @@ macro(find_ethosn use_ethosn) find_library(ETHOSN_RUNTIME_LIBRARY NAMES EthosNDriver PATHS ${__ethosn_stack}/lib) find_library(ETHOSN_RUNTIME_LIBRARY NAMES EthosNDriver) - set(ETHOSN_DEFINITIONS -DETHOSN_HW) + set(ETHOSN_DEFINITIONS -DETHOSN_HW -DETHOSN_API_VERSION=${USE_ETHOSN_API_VERSION}) endif () if(ETHOSN_COMPILER_LIBRARY) diff --git a/src/relay/backend/contrib/ethosn/capabilities.h b/src/relay/backend/contrib/ethosn/capabilities.h index 8c7ee6a0d009..cc14ca101da6 100644 --- a/src/relay/backend/contrib/ethosn/capabilities.h +++ b/src/relay/backend/contrib/ethosn/capabilities.h @@ -45,7 +45,7 @@ namespace ethosn { * variant[2] - Ethos-N37 * variant[3] - Ethos-N78 */ -#if _ETHOSN_API_VERSION_ == 2008 +#if _ETHOSN_API_VERSION_ == 2011 static std::vector variants[4] = { { 0x03, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -84,40 +84,50 @@ static std::vector variants[4] = { 0x10, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, - 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, }}; #else -static std::vector variants[3] = { +static std::vector variants[4] = { { - 0x02, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }, { - 0x02, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }, { - 0x02, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + }, + { + 0x03, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x02, 0x00, + 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, }}; #endif } // namespace ethosn diff --git a/src/relay/backend/contrib/ethosn/codegen.cc b/src/relay/backend/contrib/ethosn/codegen.cc index 3097a300a0d9..5e052b3e4fd6 100644 --- a/src/relay/backend/contrib/ethosn/codegen.cc +++ b/src/relay/backend/contrib/ethosn/codegen.cc @@ -198,8 +198,19 @@ sl::TensorsAndId MakeOps(const sl::TensorAndId& op) { NetworkWithIDs ConstructNetworkVisitor::Construct(const Function& func) { // Initialise everything +#if _ETHOSN_API_VERSION_ == 2011 + auto ctx = transform::PassContext::Current(); + auto cfg = ctx->GetConfig("relay.ext.ethos-n.options"); + if (!cfg.defined()) { + cfg = AttrsWithDefaultValues(); + } +#endif NetworkWithIDs network_with_ids; +#if _ETHOSN_API_VERSION_ == 2011 + network_ = sl::CreateNetwork(variants[cfg.value()->variant]); +#else network_ = sl::CreateNetwork(); +#endif network_with_ids.network = network_; operand_table_.clear(); @@ -561,7 +572,11 @@ sl::CompilationOptions EthosnCompiler::CreateOptions() { cfg = AttrsWithDefaultValues(); } +#if _ETHOSN_API_VERSION_ == 2011 + sl::CompilationOptions options; +#else sl::CompilationOptions options(variants[cfg.value()->variant]); +#endif options.m_Strategy0 = cfg.value()->strategy0; options.m_Strategy1 = cfg.value()->strategy1; options.m_Strategy3 = cfg.value()->strategy3; @@ -575,15 +590,13 @@ sl::CompilationOptions EthosnCompiler::CreateOptions() { options.m_BlockConfig8x32 = cfg.value()->block_config_8x32; options.m_BlockConfig8x8 = cfg.value()->block_config_8x8; options.m_EnableIntermediateCompression = cfg.value()->enable_intermediate_compression; - options.m_DisableWinograd = cfg.value()->disable_winograd; +#if _ETHOSN_API_VERSION_ == 2008 options.m_DebugInfo.m_DumpDebugFiles = cfg.value()->dump_debug_files; +#endif + options.m_DisableWinograd = cfg.value()->disable_winograd; options.m_DebugInfo.m_DebugDir = cfg.value()->debug_dir; -#if _ETHOSN_API_VERSION_ == 2008 options.m_CompilerAlgorithm = sl::EthosNCompilerAlgorithmFromString(cfg.value()->compiler_algorithm.c_str()); -#else - options.m_EnableCascading = cfg.value()->enable_cascading; -#endif return options; } @@ -606,6 +619,175 @@ std::pair, std::vector> EthosnCompiler::GetInput return std::make_pair(input_order, output_order); } +#if _ETHOSN_API_VERSION_ == 2011 +auto ctx = transform::PassContext::Current(); +auto cfg = ctx -> GetConfig("relay.ext.ethos-n.options").defined() + ? ctx -> GetConfig("relay.ext.ethos-n.options") + : AttrsWithDefaultValues(); +auto m_Queries = sl::SupportQueries(variants[cfg.value()->variant]); +#endif + +TVM_REGISTER_GLOBAL("relay.ethos-n.support.conv2d") + .set_body([](tvm::TVMArgs args, tvm::TVMRetValue* rv) { + Call call = args[0]; + ConvolutionParams params; + auto err = EthosnAPI::QnnConv2d(call, ¶ms); +#if _ETHOSN_API_VERSION_ == 2011 + if (params.is_depthwise) { + *rv = !err && + m_Queries.IsDepthwiseConvolutionSupported(params.bias_info, params.weights_info, + params.conv_info, params.activation_info); + } else { + *rv = !err && m_Queries.IsConvolutionSupported(params.bias_info, params.weights_info, + params.conv_info, params.activation_info); + } +#else + if (params.is_depthwise) { + *rv = !err && sl::IsDepthwiseConvolutionSupported(params.bias_info, params.weights_info, + params.conv_info, params.activation_info); + } else { + *rv = !err && sl::IsConvolutionSupported(params.bias_info, params.weights_info, + params.conv_info, params.activation_info); + } +#endif + }); + +TVM_REGISTER_GLOBAL("relay.ethos-n.support.fc") + .set_body([](tvm::TVMArgs args, tvm::TVMRetValue* rv) { + Call call = args[0]; + FullyConnectedParams params; + auto err = EthosnAPI::QnnFullyConnected(call, ¶ms); +#if _ETHOSN_API_VERSION_ == 2011 + *rv = !err && m_Queries.IsFullyConnectedSupported(params.bias_info, params.weights_info, + params.fc_info, params.input_info); +#else + *rv = !err && sl::IsFullyConnectedSupported(params.bias_info, params.weights_info, + params.fc_info, params.input_info); +#endif + }); + +TVM_REGISTER_GLOBAL("relay.ethos-n.support.max_pool2d") + .set_body([](tvm::TVMArgs args, tvm::TVMRetValue* rv) { + Call call = args[0]; + MaxPool2DParams params; + auto err = EthosnAPI::MaxPool2D(call, ¶ms); +#if _ETHOSN_API_VERSION_ == 2011 + *rv = !err && m_Queries.IsPoolingSupported(params.pool_info, params.input_info); +#else + *rv = !err && sl::IsPoolingSupported(params.pool_info, params.input_info); +#endif + }); + +TVM_REGISTER_GLOBAL("relay.ethos-n.support.avg_pool2d") + .set_body([](tvm::TVMArgs args, tvm::TVMRetValue* rv) { + Call call = args[0]; + AvgPool2DParams params; + auto err = EthosnAPI::AvgPool2D(call, ¶ms); +#if _ETHOSN_API_VERSION_ == 2011 + *rv = !err && m_Queries.IsPoolingSupported(params.pool_info, params.input_info); +#else + *rv = !err && sl::IsPoolingSupported(params.pool_info, params.input_info); +#endif + }); + +TVM_REGISTER_GLOBAL("relay.ethos-n.support.reshape") + .set_body([](tvm::TVMArgs args, tvm::TVMRetValue* rv) { + Call call = args[0]; + ReshapeParams params; + auto err = EthosnAPI::Reshape(call, ¶ms); +#if _ETHOSN_API_VERSION_ == 2011 + *rv = !err && m_Queries.IsReshapeSupported(params.new_shape, params.input_info); +#else + *rv = !err && sl::IsReshapeSupported(params.new_shape, params.input_info); +#endif + }); + +TVM_REGISTER_GLOBAL("relay.ethos-n.support.addition") + .set_body([](tvm::TVMArgs args, tvm::TVMRetValue* rv) { + Call call = args[0]; + AdditionParams params; + auto err = EthosnAPI::Addition(call, ¶ms); +#if _ETHOSN_API_VERSION_ == 2011 + *rv = !err && m_Queries.IsAdditionSupported(params.lhs_info, params.rhs_info, + params.output_quantization_info); +#else + *rv = !err && sl::IsAdditionSupported(params.lhs_info, params.rhs_info, + params.output_quantization_info); +#endif + }); + +TVM_REGISTER_GLOBAL("relay.ethos-n.support.sigmoid") + .set_body([](tvm::TVMArgs args, tvm::TVMRetValue* rv) { + Call call = args[0]; + SigmoidParams params; + auto err = EthosnAPI::Sigmoid(call, ¶ms); +#if _ETHOSN_API_VERSION_ == 2011 + *rv = !err && m_Queries.IsSigmoidSupported(params.input_info); +#else + *rv = !err && sl::IsSigmoidSupported(params.input_info); +#endif + }); + +TVM_REGISTER_GLOBAL("relay.ethos-n.support.concatenate") + .set_body([](tvm::TVMArgs args, tvm::TVMRetValue* rv) { + Call call = args[0]; + ConcatenateParams params; + auto err = EthosnAPI::Concatenate(call, ¶ms); +#if _ETHOSN_API_VERSION_ == 2011 + *rv = !err && m_Queries.IsConcatenationSupported(params.input_infos, params.concat_info); +#else + *rv = !err && sl::IsConcatenationSupported(params.input_infos, params.concat_info); +#endif + }); + +TVM_REGISTER_GLOBAL("relay.ethos-n.support.split") + .set_body([](tvm::TVMArgs args, tvm::TVMRetValue* rv) { + Call call = args[0]; + SplitParams params; + auto err = EthosnAPI::Split(call, ¶ms); +#if _ETHOSN_API_VERSION_ == 2011 + *rv = !err && m_Queries.IsSplitSupported(params.input_info, params.split_info); +#else + *rv = !err && sl::IsSplitSupported(params.input_info, params.split_info); +#endif + }); + +TVM_REGISTER_GLOBAL("relay.ethos-n.support.depth_to_space") + .set_body([](tvm::TVMArgs args, tvm::TVMRetValue* rv) { + Call call = args[0]; + DepthToSpaceParams params; + auto err = EthosnAPI::DepthToSpace(call, ¶ms); +#if _ETHOSN_API_VERSION_ == 2011 + *rv = !err && m_Queries.IsDepthToSpaceSupported(params.input_info, params.depth_info); +#else + *rv = !err && sl::IsDepthToSpaceSupported(params.input_info, params.depth_info); +#endif + }); + +TVM_REGISTER_GLOBAL("relay.ethos-n.support.relu") + .set_body([](tvm::TVMArgs args, tvm::TVMRetValue* rv) { + Call call = args[0]; + ReluParams params; + auto err = EthosnAPI::Relu(call, ¶ms); +#if _ETHOSN_API_VERSION_ == 2011 + *rv = !err && m_Queries.IsReluSupported(params.relu_info, params.input_info); +#else + *rv = !err && sl::IsReluSupported(params.relu_info, params.input_info); +#endif + }); + +TVM_REGISTER_GLOBAL("relay.ethos-n.query").set_body([](tvm::TVMArgs args, tvm::TVMRetValue* rv) { +#if defined ETHOSN_HW + *rv = true; +#else + *rv = false; +#endif +}); + +TVM_REGISTER_GLOBAL("relay.ethos-n.api.version").set_body_typed([]() -> int { + return _ETHOSN_API_VERSION_; +}); + } // namespace ethosn } // namespace contrib } // namespace relay diff --git a/src/relay/backend/contrib/ethosn/codegen_ethosn.h b/src/relay/backend/contrib/ethosn/codegen_ethosn.h index 9887a2b3ad78..e44aa31d6b13 100644 --- a/src/relay/backend/contrib/ethosn/codegen_ethosn.h +++ b/src/relay/backend/contrib/ethosn/codegen_ethosn.h @@ -240,14 +240,12 @@ struct EthosnCompilerConfigNode : public tvm::AttrsNode int { - return _ETHOSN_API_VERSION_; -}); - } // namespace ethosn } // namespace contrib } // namespace relay diff --git a/src/relay/backend/contrib/ethosn/ethosn_api_version.h b/src/relay/backend/contrib/ethosn/ethosn_api_version.h index 618b702da333..78f08950bb48 100644 --- a/src/relay/backend/contrib/ethosn/ethosn_api_version.h +++ b/src/relay/backend/contrib/ethosn/ethosn_api_version.h @@ -29,10 +29,12 @@ * along with associated compatibility measures when no * longer necessary. */ +#ifndef ETHOSN_API_VERSION #define _ETHOSN_API_VERSION_ 2008 -#ifndef COMPILER_ALGORITHM_MODE -#undef _ETHOSN_API_VERSION_ -#define _ETHOSN_API_VERSION_ 2005 +#elif ~(~ETHOSN_API_VERSION + 0) == 0 && ~(~ETHOSN_API_VERSION + 1) == 1 +#define _ETHOSN_API_VERSION_ 2008 +#else +#define _ETHOSN_API_VERSION_ ETHOSN_API_VERSION #endif #endif // TVM_RELAY_BACKEND_CONTRIB_ETHOSN_ETHOSN_API_VERSION_H_ diff --git a/tests/python/contrib/test_ethosn/test_networks.py b/tests/python/contrib/test_ethosn/test_networks.py index e0eccdfb30f5..06ce93b2aba5 100644 --- a/tests/python/contrib/test_ethosn/test_networks.py +++ b/tests/python/contrib/test_ethosn/test_networks.py @@ -127,6 +127,10 @@ def test_mobilenet_v1(): _compile_hash = {"47e216d8ab2bf491708ccf5620bc0d02"} if tei.get_ethosn_variant() == 3: _compile_hash = {"2436f523e263f66a063cef902f2f43d7"} + if tei.get_ethosn_api_version() == 2011: + _compile_hash = {"9298b6c51e2a82f70e91dd11dd6af412"} + if tei.get_ethosn_variant() == 3: + _compile_hash = {"407eb47346c8afea2d15e8f0d1c079f2"} _test_image_network( model_url="https://storage.googleapis.com/download.tensorflow.org/" "models/mobilenet_v1_2018_08_02/mobilenet_v1_1.0_224_quant.tgz", @@ -151,6 +155,10 @@ def test_inception_v3(): _compile_hash = {"8c9d75659cd7bc9ff6dd6d490d28f9b2"} if tei.get_ethosn_variant() == 3: _compile_hash = {"cdd4d7f6453d722ea73224ff9d6a115a"} + if tei.get_ethosn_api_version() == 2011: + _compile_hash = {"d44eece5027ff56e5e7fcf014367378d"} + if tei.get_ethosn_variant() == 3: + _compile_hash = {"1ba555b4bc60c428018a0f2de9d90532"} _test_image_network( model_url="https://storage.googleapis.com/download.tensorflow.org/" "models/tflite_11_05_08/inception_v3_quant.tgz", @@ -169,11 +177,17 @@ def test_inception_v4(): # codegen, which could come about from either a change in Support Library # version or a change in the Ethos-N codegen. To update this requires running # on hardware that isn't available in CI. - if not tei.get_ethosn_variant() == 0: - pytest.skip("Ethos-N78 20.08 does not support inception_v4 in the default configuration.") _compile_hash = {"06bf6cb56344f3904bcb108e54edfe87"} if tei.get_ethosn_api_version() == 2008: + if not tei.get_ethosn_variant() == 0: + pytest.skip( + "Ethos-N78 20.08 does not support inception_v4 in the default configuration." + ) _compile_hash = {"798292bfa596ca7c32086396b494b46c"} + if tei.get_ethosn_api_version() == 2011: + _compile_hash = {"53f126cf654d4cf61ebb23c767f6740b"} + if tei.get_ethosn_variant() == 3: + _compile_hash = {"851665c060cf4719248919d17325ae02"} _test_image_network( model_url="https://storage.googleapis.com/download.tensorflow.org/" "models/inception_v4_299_quant_20181026.tgz", @@ -197,6 +211,10 @@ def test_ssd_mobilenet_v1(): _compile_hash = {"5999f26e140dee0d7866491997ef78c5", "24e3a690a7e95780052792d5626c85be"} if tei.get_ethosn_variant() == 3: _compile_hash = {"da871b3f03a93df69d704ed44584d6cd", "9f52411d301f3cba3f6e4c0f1c558e87"} + if tei.get_ethosn_api_version() == 2011: + _compile_hash = {"6e8c4586bdd26527c642a4f016f52284", "057c5efb094c79fbe4483b561147f1d2"} + if tei.get_ethosn_variant() == 3: + _compile_hash = {"dc687e60a4b6750fe740853f22aeb2dc", "1949d86100004eca41099c8e6fa919ab"} _test_image_network( model_url="https://storage.googleapis.com/download.tensorflow.org/" "models/tflite/coco_ssd_mobilenet_v1_1.0_quant_2018_06_29.zip", diff --git a/tests/python/contrib/test_ethosn/test_reshape.py b/tests/python/contrib/test_ethosn/test_reshape.py index 4afec557e569..20df5f9bd288 100644 --- a/tests/python/contrib/test_ethosn/test_reshape.py +++ b/tests/python/contrib/test_ethosn/test_reshape.py @@ -37,8 +37,8 @@ def test_reshape(): return trials = [ - ((1, 15, 4, 1), (60,)), - ((1, 15, 4, 1), (30, 2)), + ((1, 15, 4, 1), (1, 60)), + ((1, 15, 4, 1), (1, 30, 2)), ((1, 15, 4, 1), (1, 4, 15, 1)), ((1, 15, 4, 1), (1, 12, 5, 1)), ((1, 15, 4, 1), (1, -1, 2, 1)),