未验证 提交 33db40fb 编写于 作者: D David Davis 提交者: GitHub

Flatten kernel namespace: RESHAPE (#2106)

@tensorflow/micro

Flatten namespace for kernel operator RESHAPE

Update unit tests namespace usage

Update MicroOpResolver namespace usage

bug=fixes #2105
上级 13cd6d82
......@@ -100,6 +100,7 @@ TFLMRegistration Register_READ_VARIABLE();
TFLMRegistration Register_REDUCE_MAX();
TFLMRegistration Register_RELU();
TFLMRegistration Register_RELU6();
TFLMRegistration Register_RESHAPE();
TFLMRegistration Register_RESIZE_BILINEAR();
TFLMRegistration Register_RESIZE_NEAREST_NEIGHBOR();
TFLMRegistration Register_RSQRT();
......@@ -137,7 +138,6 @@ TFLMRegistration* Register_WINDOW();
namespace ops {
namespace micro {
TFLMRegistration Register_RESHAPE();
TFLMRegistration Register_ROUND();
} // namespace micro
} // namespace ops
......
......@@ -27,9 +27,7 @@ limitations under the License.
#include "tensorflow/lite/micro/micro_utils.h"
namespace tflite {
namespace ops {
namespace micro {
namespace reshape {
namespace {
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
const TfLiteEvalTensor* input =
......@@ -51,13 +49,10 @@ TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
return kTfLiteOk;
}
} // namespace reshape
} // namespace
TFLMRegistration Register_RESHAPE() {
return tflite::micro::RegisterOp(nullptr, reshape::PrepareReshapeReference,
reshape::Eval);
return tflite::micro::RegisterOp(nullptr, PrepareReshapeReference, Eval);
}
} // namespace micro
} // namespace ops
} // namespace tflite
......@@ -17,16 +17,10 @@ limitations under the License.
#include "tensorflow/lite/c/common.h"
namespace tflite {
namespace ops {
namespace micro {
namespace reshape {
constexpr int kReshapeInputTensor = 0;
constexpr int kReshapeOutputTensor = 0;
TfLiteStatus PrepareReshapeReference(TfLiteContext* context, TfLiteNode* node);
} // namespace reshape
} // namespace micro
} // namespace ops
} // namespace tflite
......@@ -26,9 +26,6 @@ limitations under the License.
#include "tensorflow/lite/micro/micro_utils.h"
namespace tflite {
namespace ops {
namespace micro {
namespace reshape {
namespace {
......@@ -94,7 +91,4 @@ TfLiteStatus PrepareReshapeReference(TfLiteContext* context, TfLiteNode* node) {
return kTfLiteOk;
}
} // namespace reshape
} // namespace micro
} // namespace ops
} // namespace tflite
......@@ -38,7 +38,7 @@ void ValidateReshapeGoldens(TfLiteTensor* tensors, int tensors_size,
const size_t expected_output_len,
int* expected_dims, const size_t expected_dims_len,
bool expect_failure) {
const TFLMRegistration registration = tflite::ops::micro::Register_RESHAPE();
const TFLMRegistration registration = tflite::Register_RESHAPE();
micro::KernelRunner runner(registration, tensors, tensors_size, inputs_array,
outputs_array,
/*builtin_data=*/nullptr);
......
......@@ -29,9 +29,7 @@ limitations under the License.
#include "tensorflow/lite/micro/micro_utils.h"
namespace tflite {
namespace ops {
namespace micro {
namespace reshape {
namespace {
#if defined(VISION_P6)
void* Init(TfLiteContext* context, const char* buffer, size_t length) {
......@@ -91,17 +89,14 @@ TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
return kTfLiteOk;
}
} // namespace reshape
} // namespace
TFLMRegistration Register_RESHAPE() {
#if defined(VISION_P6)
return tflite::micro::RegisterOp(reshape::Init, reshape::Prepare,
reshape::Eval);
return tflite::micro::RegisterOp(Init, Prepare, Eval);
#else
return tflite::micro::RegisterOp(nullptr, reshape::Prepare, reshape::Eval);
return tflite::micro::RegisterOp(nullptr, Prepare, Eval);
#endif
}
} // namespace micro
} // namespace ops
} // namespace tflite
/* Copyright 2022 The TensorFlow Authors. All Rights Reserved.
/* Copyright 2023 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
......@@ -24,6 +24,7 @@ limitations under the License.
#include "tensorflow/lite/kernels/internal/tensor_ctypes.h"
#include "tensorflow/lite/kernels/kernel_util.h"
#include "tensorflow/lite/micro/kernels/kernel_util.h"
#include "tensorflow/lite/micro/kernels/reshape.h"
#include "tensorflow/lite/micro/kernels/xtensa/xtensa.h"
#include "tensorflow/lite/micro/kernels/xtensa/xtensa_reshape.h"
......
......@@ -22,9 +22,6 @@ limitations under the License.
namespace tflite {
constexpr int kReshapeInputTensor = 0;
constexpr int kReshapeOutputTensor = 0;
#if defined(VISION_P6)
struct XtensaReshapeData {
......
......@@ -429,8 +429,8 @@ class MicroMutableOpResolver : public MicroOpResolver {
}
TfLiteStatus AddReshape() {
return AddBuiltin(BuiltinOperator_RESHAPE,
tflite::ops::micro::Register_RESHAPE(), ParseReshape);
return AddBuiltin(BuiltinOperator_RESHAPE, Register_RESHAPE(),
ParseReshape);
}
TfLiteStatus AddResizeBilinear() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册