aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/contrib/lite/kernels/conv.cc
diff options
context:
space:
mode:
authorGravatar Yu-Cheng Ling <ycling@google.com>2018-02-16 19:02:58 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-02-16 19:09:48 -0800
commit02bbb131b78fb0924675809ed5b549e594a51ac1 (patch)
treecf1399679db777396cc6c841a465d15e6ca8e0e5 /tensorflow/contrib/lite/kernels/conv.cc
parentbd9224f5a066be8ec591bb2ac79c8bd87a9a395b (diff)
Automated g4 rollback of changelist 186053793
PiperOrigin-RevId: 186075274
Diffstat (limited to 'tensorflow/contrib/lite/kernels/conv.cc')
-rw-r--r--tensorflow/contrib/lite/kernels/conv.cc14
1 files changed, 4 insertions, 10 deletions
diff --git a/tensorflow/contrib/lite/kernels/conv.cc b/tensorflow/contrib/lite/kernels/conv.cc
index 495910aab6..66d2c04bba 100644
--- a/tensorflow/contrib/lite/kernels/conv.cc
+++ b/tensorflow/contrib/lite/kernels/conv.cc
@@ -51,13 +51,11 @@ enum KernelType {
kCblasOptimized,
};
-const int kTensorNotAllocated = -1;
-
struct OpData {
// IDs are the arbitrary identifiers used by TF Lite to identify and access
// memory buffers.
- int im2col_id = kTensorNotAllocated;
- int hwcn_weights_id = kTensorNotAllocated;
+ int im2col_id;
+ int hwcn_weights_id;
TfLitePaddingValues padding;
// The scaling factor from input to output (aka the 'real multiplier') can
@@ -82,6 +80,8 @@ void* Init(TfLiteContext* context, const char* buffer, size_t length) {
// Instead, we allocate a new object to use as scratch space for im2col, and
// to carry information from Prepare() to Eval().
auto* data = new OpData;
+ context->AddTensors(context, 1, &data->im2col_id);
+ context->AddTensors(context, 1, &data->hwcn_weights_id);
gemm_support::IncrementUsageCounter(context);
return data;
}
@@ -219,16 +219,10 @@ TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
int temporaries_count = 0;
if (data->need_im2col) {
data->im2col_index = temporaries_count;
- if (data->im2col_id == kTensorNotAllocated) {
- context->AddTensors(context, 1, &data->im2col_id);
- }
++temporaries_count;
}
if (data->need_hwcn_weights) {
data->hwcn_weights_index = temporaries_count;
- if (data->hwcn_weights_id == kTensorNotAllocated) {
- context->AddTensors(context, 1, &data->hwcn_weights_id);
- }
++temporaries_count;
}