Skip to content

Commit

Permalink
Add dimension to subgraph test tensors
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 609346048
  • Loading branch information
alankelly authored and tensorflower-gardener committed Feb 22, 2024
1 parent f038682 commit ce97af5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tensorflow/lite/kernels/subgraph_test_util.cc
Expand Up @@ -176,6 +176,13 @@ void AddDynamicUpdateSliceNode(Subgraph* subgraph, int input0, int input1,
}
} // namespace

void Setup1DTensor(Subgraph* subgraph, int tensor_index, TfLiteType type) {
int dim = 1;
ASSERT_EQ(subgraph->SetTensorParametersReadWrite(tensor_index, type, "", 1,
&dim, {}, false),
kTfLiteOk);
}

void SetupTensor(Subgraph* subgraph, int tensor_index, TfLiteType type) {
ASSERT_EQ(subgraph->SetTensorParametersReadWrite(tensor_index, type, "", 0,
nullptr, {}, false),
Expand Down Expand Up @@ -275,7 +282,7 @@ void SubgraphBuilder::BuildOutputNotConsumedSubgraph(Subgraph& subgraph) {
ASSERT_EQ(subgraph.SetInputs({kInput0, kInput1, kInput2}), kTfLiteOk);
ASSERT_EQ(subgraph.SetOutputs({kOutput0, kOutput1, kConstRhs}), kTfLiteOk);
for (int i = 0; i < kTensorCount; ++i) {
SetupTensor(&subgraph, i, kTfLiteInt32);
Setup1DTensor(&subgraph, i, kTfLiteInt32);
}

// kInput0 --> +---+
Expand Down

0 comments on commit ce97af5

Please sign in to comment.