Skip to content

Commit 0859a8f

Browse files
ssjhvcopybara-github
authored andcommitted
TF Lite API related fix.
PiperOrigin-RevId: 539797484 Change-Id: I6a19f9330e5db6fa97bbdce10206b11d0769a66c
1 parent 0abd2bc commit 0859a8f

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

tensorflow_compression/cc/tflite/range_coder_kernels.cc

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,18 @@ TfLiteStatus CheckOutputTypes(TfLiteContext* context, TfLiteNode* node) {
9191
return CheckOutputTypesImpl<t...>(context, node, 0);
9292
}
9393

94+
struct TfLiteIntArrayDeleter {
95+
void operator()(TfLiteIntArray* p) {
96+
if (p) TfLiteIntArrayFree(p);
97+
}
98+
};
99+
94100
// REQUIRES: tensor->type == kTfLiteInt32
95101
// REQUIRES: NumDimensions(tensor) == 1
96-
std::unique_ptr<TfLiteIntArray, tflite::TfLiteIntArrayDeleter> MakeShape(
102+
std::unique_ptr<TfLiteIntArray, TfLiteIntArrayDeleter> MakeShape(
97103
const TfLiteTensor* tensor) {
98104
const int dims = SizeOfDimension(tensor, 0);
99-
std::unique_ptr<TfLiteIntArray, tflite::TfLiteIntArrayDeleter> shape(
105+
std::unique_ptr<TfLiteIntArray, TfLiteIntArrayDeleter> shape(
100106
TfLiteIntArrayCreate(dims));
101107
std::copy_n(GetTensorData<int32_t>(tensor), dims, shape->data);
102108
return shape;

0 commit comments

Comments
 (0)