diff options
author | Yu-Cheng Ling <ycling@google.com> | 2018-06-27 17:49:02 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2018-06-27 17:52:33 -0700 |
commit | 9884282a97f8561a7780fbd541a8c1d436304e53 (patch) | |
tree | cd2aea0a52cb81ddc614c9c0396148097f940f30 | |
parent | 8f566b35180beda9c1f90b30c5d52c664821787c (diff) |
Use persistent tensor for Convolution HWCN weights
PiperOrigin-RevId: 202400843
-rw-r--r-- | tensorflow/contrib/lite/kernels/conv.cc | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/tensorflow/contrib/lite/kernels/conv.cc b/tensorflow/contrib/lite/kernels/conv.cc index 2bd9e0867a..0321b2e2a0 100644 --- a/tensorflow/contrib/lite/kernels/conv.cc +++ b/tensorflow/contrib/lite/kernels/conv.cc @@ -309,18 +309,8 @@ TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) { TfLiteTensor* hwcn_weights = &context->tensors[node->temporaries->data[data->hwcn_weights_index]]; hwcn_weights->type = data_type; - hwcn_weights->allocation_type = kTfLiteDynamic; - // Make sure we release any previous allocations before we reallocate. - // TODO(petewarden): Persistent arenas would be a better fit for this, but - // they aren't fully implemented yet. - if (hwcn_weights->data.raw) { - free(hwcn_weights->data.raw); - hwcn_weights->data.raw = nullptr; - } + hwcn_weights->allocation_type = kTfLiteArenaRwPersistent; - // Note that hwcn_weights_status is a kTfLiteDynamic tensor, and - // ResizeTensor will actually allocate space for it. The would be more - // efficient if we placed hwcn_weights_status in the persistent arena. auto hwcn_weights_status = context->ResizeTensor(context, hwcn_weights, hwcn_weights_size); if (hwcn_weights_status != kTfLiteOk) return hwcn_weights_status; |