message: Lite: ResizeTensor Dim size check added to avoid reallocation if no change
diff: @@ -740,6 +740,18 @@ TfLiteStatus Subgraph::Invoke() {
  TfLiteStatus Subgraph::ResizeTensor(TfLiteContext* context,
  TfLiteTensor* tensor,
  TfLiteIntArray* new_size) {
  + // If the dimensions don't change, avoiding
  + // unnecessary (re)allocations.
  + //
  + // Note that it's required to check `tensor->data.raw != nullptr`. Otherwise
  + // the subgraph won't allocate memory for a dynamic tensor when its size
  + // is equal to the original tensor size.
  + if (tensor->data.raw != nullptr &&
  + EqualArrayAndTfLiteIntArray(tensor->dims, new_size->size,
  + new_size->data)) {
  + return kTfLiteOk;
  + }
  +
  // Note here that context->impl_ is recovering the this pointer for an
  // instance of Interpreter to call into the member function ResizeTensorImpl
  // (this function is static).
  