diff options
author | A. Unique TensorFlower <gardener@tensorflow.org> | 2018-02-05 10:39:18 -0800 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2018-02-05 10:45:07 -0800 |
commit | bccd80c45dab8f2856c176d45df7e7c72f35e14e (patch) | |
tree | 5429e28464f74889cc4ca8c179da0e35f6e61a80 /tensorflow/contrib/lite/kernels/conv.cc | |
parent | a9034babfd0100f0b998e900d074dd3d839d18bc (diff) |
Proper reallocation of dynamic tensors.
PiperOrigin-RevId: 184550199
Diffstat (limited to 'tensorflow/contrib/lite/kernels/conv.cc')
-rw-r--r-- | tensorflow/contrib/lite/kernels/conv.cc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/tensorflow/contrib/lite/kernels/conv.cc b/tensorflow/contrib/lite/kernels/conv.cc index 7a45647434..1fba3cbbce 100644 --- a/tensorflow/contrib/lite/kernels/conv.cc +++ b/tensorflow/contrib/lite/kernels/conv.cc @@ -271,10 +271,13 @@ TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) { free(hwcn_weights->data.raw); hwcn_weights->data.raw = nullptr; } + + // 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; - hwcn_weights->data.raw = static_cast<char*>(malloc(hwcn_weights->bytes)); // TODO(petewarden): If Resize() is called when the size hasn't actually // changed, this will do extra redundant work. |