tensorflow/lite/experimental/acceleration/mini_benchmark/call.cc
// Verifies that number of outputs match for subgraph and CALL node. Infer the
// shape and type of outputs for CALL node and resize accordingly.
Verifies that number of outputs match for subgraph and CALL node. Infer the
shape and type of outputs for CALL node and resize accordingly.
Verifies that number of outputs match for subgraph and CALL node . Infer the shape and type of outputs for CALL node and resize accordingly .
TfLiteStatus ValidateAndResizeOutputs(TfLiteContext* context, TfLiteNode* node,
                                      Subgraph* subgraph, int loop_count) {
  TF_LITE_ENSURE_EQ(context, subgraph->outputs().size(), node->outputs->size);
  for (int i = 0; i < node->outputs->size; ++i) {
    const TfLiteTensor* subgraph_output =
        subgraph->tensor(subgraph->outputs()[i]);
    TfLiteTensor* node_output = context->tensors + node->outputs->data[i];
    TF_LITE_ASSERT(subgraph_output->dims->size > 0);
    TfLiteIntArray* new_dims_array = TfLiteIntArrayCopy(subgraph_output->dims);
    new_dims_array->data[0] = loop_count;
    TF_LITE_ENSURE_OK(
        context, context->ResizeTensor(context, node_output, new_dims_array));
    node_output->type = subgraph_output->type;
  }
  return kTfLiteOk;
}
TfLiteStatus ValidateAndResizeOutputs ( TfLiteContext * context , TfLiteNode * node , Subgraph * subgraph , int loop_count ) { TF_LITE_ENSURE_EQ ( context , subgraph -> outputs ( ) . size ( ) , node -> outputs -> size ) ; for ( int i = 0 ; i < node -> outputs -> size ; ++ i ) { const TfLiteTensor * subgraph_output = subgraph -> tensor ( subgraph -> outputs ( ) [ i ] ) ; TfLiteTensor * node_output = context -> tensors + node -> outputs -> data [ i ] ; TF_LITE_ASSERT ( subgraph_output -> dims -> size > 0 ) ; TfLiteIntArray * new_dims_array = TfLiteIntArrayCopy ( subgraph_output -> dims ) ; new_dims_array -> data [ 0 ] = loop_count ; TF_LITE_ENSURE_OK ( context , context -> ResizeTensor ( context , node_output , new_dims_array ) ) ; node_output -> type = subgraph_output -> type ; } return kTfLiteOk ; }
Verifies that number of outputs match for subgraph and CALL node.
Verifies that number of outputs match for subgraph and CALL node .
// Match number of outputs for subgraph and CALL node. // Infer output shape for the CALL node. // Batch size is fixed as `loop_count` for CALL node.