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 889239f93215a309d5434b209ebfc1f584c47849..bc438f99c6a72fdbc2794dee03524db6a7523834 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 ec1c40202761e3789462a4740e5547eba654b0f9..aff19581ea56f94c08638b7b388ae181f566cf4f 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 48114e5a4069abf864a996141c7b0906301d9809..c29da3862e84d6756bf5ef34b2ca06307b0a065d 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 c5d60cae3ab0b203299e04a25c392519a2a23b75..9e3e19c09a4012ebdadbc2a7c2ba06c4bfefd206 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 e2e1873f770fad889137b43d87585602162819f7..d8c9e352f00627eee45ae836b720f2af77140538 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 c4ffdf79d3aa7d47b9747bdf4208f8317d9fd22e..fb1e11e0ca00abb36d7f29d562711a7bbcbeca1c 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 093814bc4494041809d6e82965519e38a8997f49..d3c10a9bb7b07404ccd8cfe2636473a622b91787 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