Skip to content

Commit 285b5a0

Browse files
authored
Sync from tflite-micro. (tensorflow#177)
1 parent 1f0bd2e commit 285b5a0

File tree

4 files changed

+13
-12
lines changed

4 files changed

+13
-12
lines changed

src/tensorflow/lite/micro/kernels/micro_ops.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ TfLiteRegistration Register_SLICE();
100100
TfLiteRegistration Register_SOFTMAX();
101101
TfLiteRegistration Register_SPACE_TO_BATCH_ND();
102102
TfLiteRegistration Register_SPACE_TO_DEPTH();
103+
TfLiteRegistration Register_SPLIT();
103104
TfLiteRegistration Register_SPLIT_V();
104105
TfLiteRegistration Register_SQUARED_DIFFERENCE();
105106
TfLiteRegistration Register_SQUEEZE();
@@ -127,7 +128,6 @@ TfLiteRegistration Register_RESIZE_NEAREST_NEIGHBOR();
127128
TfLiteRegistration Register_ROUND();
128129
TfLiteRegistration Register_RSQRT();
129130
TfLiteRegistration Register_SIN();
130-
TfLiteRegistration Register_SPLIT();
131131
TfLiteRegistration Register_SQRT();
132132
TfLiteRegistration Register_SQUARE();
133133
TfLiteRegistration Register_UNPACK();

src/tensorflow/lite/micro/kernels/reshape.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright 2017 The TensorFlow Authors. All Rights Reserved.
1+
/* Copyright 2023 The TensorFlow Authors. All Rights Reserved.
22
33
Licensed under the Apache License, Version 2.0 (the "License");
44
you may not use this file except in compliance with the License.
@@ -68,6 +68,11 @@ TfLiteStatus ReshapeOutput(TfLiteContext* context, TfLiteNode* node) {
6868
}
6969
}
7070
if (stretch_dim != -1) {
71+
TfLiteEvalTensor* output_eval =
72+
tflite::micro::GetEvalOutput(context, node, kOutputTensor);
73+
TF_LITE_ENSURE_STATUS(tflite::micro::CreateWritableTensorDimsWithCopy(
74+
context, output, output_eval));
75+
output_shape = output->dims; // output tensor dims were moved
7176
output_shape->data[stretch_dim] = num_input_elements / num_output_elements;
7277
num_output_elements *= output_shape->data[stretch_dim];
7378
}

src/tensorflow/lite/micro/kernels/split.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
1+
/* Copyright 2023 The TensorFlow Authors. All Rights Reserved.
22
33
Licensed under the Apache License, Version 2.0 (the "License");
44
you may not use this file except in compliance with the License.
@@ -21,9 +21,8 @@ limitations under the License.
2121
#include "tensorflow/lite/micro/micro_log.h"
2222

2323
namespace tflite {
24-
namespace ops {
25-
namespace micro {
26-
namespace split {
24+
25+
namespace {
2726

2827
template <typename T>
2928
TfLiteStatus SplitImpl(TfLiteContext* context, TfLiteNode* node,
@@ -117,12 +116,10 @@ TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
117116
return kTfLiteOk;
118117
}
119118

120-
} // namespace split
119+
} // namespace
121120

122121
TfLiteRegistration Register_SPLIT() {
123-
return tflite::micro::RegisterOp(nullptr, split::Prepare, split::Eval);
122+
return tflite::micro::RegisterOp(nullptr, Prepare, Eval);
124123
}
125124

126-
} // namespace micro
127-
} // namespace ops
128125
} // namespace tflite

src/tensorflow/lite/micro/micro_mutable_op_resolver.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,8 +492,7 @@ class MicroMutableOpResolver : public MicroOpResolver {
492492
}
493493

494494
TfLiteStatus AddSplit() {
495-
return AddBuiltin(BuiltinOperator_SPLIT,
496-
tflite::ops::micro::Register_SPLIT(), ParseSplit);
495+
return AddBuiltin(BuiltinOperator_SPLIT, Register_SPLIT(), ParseSplit);
497496
}
498497

499498
TfLiteStatus AddSplitV() {

0 commit comments

Comments
 (0)