Remove redundant calls to realloc dynamic tensors.
authorA. Unique TensorFlower <gardener@tensorflow.org>
Tue, 6 Feb 2018 16:11:41 +0000 (08:11 -0800)
committerTensorFlower Gardener <gardener@tensorflow.org>
Tue, 6 Feb 2018 16:15:25 +0000 (08:15 -0800)
PiperOrigin-RevId: 184682942

tensorflow/contrib/lite/kernels/batch_to_space_nd.cc
tensorflow/contrib/lite/kernels/mean.cc
tensorflow/contrib/lite/kernels/pad.cc
tensorflow/contrib/lite/kernels/resize_bilinear.cc
tensorflow/contrib/lite/kernels/space_to_batch_nd.cc
tensorflow/contrib/lite/kernels/strided_slice.cc
tensorflow/contrib/lite/kernels/transpose.cc

index 889239f..bc438f9 100644 (file)
@@ -116,7 +116,6 @@ TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
   // Resize the output tensor if the output tensor is dynamic.
   if (IsDynamicTensor(op_context.output)) {
     TF_LITE_ENSURE_OK(context, ResizeOutputTensor(context, &op_context));
-    TfLiteTensorRealloc(op_context.output->bytes, op_context.output);
   }
 
 #define TF_LITE_BATCH_TO_SPACE_ND(type, scalar)                        \
index ec1c402..aff1958 100644 (file)
@@ -183,8 +183,6 @@ TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
     TF_LITE_ENSURE_OK(context,
                       ResizeTempAxis(context, &op_context, resolved_axis));
     TF_LITE_ENSURE_OK(context, ResizeOutputTensor(context, &op_context));
-    TfLiteTensorRealloc(resolved_axis->bytes, resolved_axis);
-    TfLiteTensorRealloc(op_context.output->bytes, op_context.output);
   }
 
 #define TF_LITE_MEAN(kernel_type, data_type)                        \
index 48114e5..c29da38 100644 (file)
@@ -101,7 +101,6 @@ TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
   // Resize the output tensor if the output tensor is dynamic.
   if (IsDynamicTensor(op_context.output)) {
     TF_LITE_ENSURE_OK(context, ResizeOutputTensor(context, &op_context));
-    TfLiteTensorRealloc(op_context.output->bytes, op_context.output);
   }
 
   // TODO(nupurgarg): Change kernel implementation to take in int* instead of
index c5d60ca..9e3e19c 100644 (file)
@@ -85,7 +85,6 @@ TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
   if (IsDynamicTensor(output)) {
     TF_LITE_ENSURE_OK(context,
                       ResizeOutputTensor(context, input, size, output));
-    TfLiteTensorRealloc(output->bytes, output);
   }
 
   if (output->type == kTfLiteFloat32) {
index e2e1873..d8c9e35 100644 (file)
@@ -111,7 +111,6 @@ TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
   // Resize the output tensor if the output tensor is dynamic.
   if (IsDynamicTensor(op_context.output)) {
     TF_LITE_ENSURE_OK(context, ResizeOutputTensor(context, &op_context));
-    TfLiteTensorRealloc(op_context.output->bytes, op_context.output);
   }
 
 #define TF_LITE_SPACE_TO_BATCH_ND(type, scalar)                        \
index c4ffdf7..fb1e11e 100644 (file)
@@ -181,7 +181,6 @@ TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
 
   if (IsDynamicTensor(op_context.output)) {
     TF_LITE_ENSURE_OK(context, ResizeOutputTensor(context, &op_context));
-    TfLiteTensorRealloc(op_context.output->bytes, op_context.output);
   }
 
   std::vector<int32_t> starts;
index 093814b..d3c10a9 100644 (file)
@@ -90,7 +90,6 @@ TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
   // Resize the output tensor if the output tensor is dynamic.
   if (IsDynamicTensor(op_context.output)) {
     TF_LITE_ENSURE_OK(context, ResizeOutputTensor(context, &op_context));
-    TfLiteTensorRealloc(op_context.output->bytes, op_context.output);
   }
 
   // Reverse the permuted axes and convert to 4D due to the way Dims are