提交 9b113355 编写于 作者: S Sachin Joglekar 提交者: TensorFlower Gardener

Fix Hexagon unit tests by reducing min nodes per partitions to 1

PiperOrigin-RevId: 306667501
Change-Id: Id91da849cd77dd8861786841d8194c5e6d2a04fb
上级 95c4ce95
......@@ -44,6 +44,8 @@ class SingleOpModelWithHexagon : public SingleOpModel {
"vendor/lib/rfsa/adsp;/dsp",
1 /*overwrite*/);
// For tests, we use one-op-models.
params_.min_nodes_per_partition = 1;
auto* delegate_ptr = TfLiteHexagonDelegateCreate(&params_);
ASSERT_TRUE(delegate_ptr != nullptr);
delegate_ = Interpreter::TfLiteDelegatePtr(
......
......@@ -95,7 +95,7 @@ TfLiteStatus DelegatePrepare(TfLiteContext* context, TfLiteDelegate* delegate) {
TfLiteHexagonDelegateOptions* params =
static_cast<TfLiteHexagonDelegateOptions*>(delegate->data_);
const auto delegate_partitions = helper.GetFirstNLargestPartitions(
params->max_delegated_partitions, kMinNodesPerHexagonGraph);
params->max_delegated_partitions, params->min_nodes_per_partition);
// To avoid creating a new TfLiteIntArray and free it later, we reserve one
// element to represent TfLiteIntArray.size which is the 1st element of
......@@ -133,6 +133,9 @@ class HexagonDelegate : public TfLiteDelegate {
params_.max_delegated_partitions, kMaxMaxHexagonGraphs);
params_.max_delegated_partitions = kMaxMaxHexagonGraphs;
}
if (params_.min_nodes_per_partition <= 0) {
params_.min_nodes_per_partition = kMinNodesPerHexagonGraph;
}
}
TfLiteHexagonDelegateOptions* params() { return &params_; }
......
......@@ -55,6 +55,9 @@ struct TFL_CAPI_EXPORT TfLiteHexagonDelegateOptions {
// hexagon_nn_init. Each graph corresponds to one delegated node subset in the
// TFLite model.
int max_delegated_partitions;
// This sets the minimum number of nodes per graph created with
// hexagon_nn_init. Defaults to 2.
int min_nodes_per_partition;
};
// Return a delegate that uses Hexagon SDK for ops execution.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册