From 75f57a8b7836a1ed3cda8ba81c88f6caf15cf0c6 Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Mon, 8 Oct 2018 08:35:14 -0700 Subject: Remove Dims from types.h, create build structure. PiperOrigin-RevId: 216191084 --- tensorflow/contrib/lite/kernels/internal/BUILD | 16 +++++++++++++ .../contrib/lite/kernels/internal/legacy_types.h | 26 ++++++++++++++++++++++ .../internal/reference/legacy_reference_ops.h | 7 +++++- .../kernels/internal/reference/reference_ops.h | 5 ----- 4 files changed, 48 insertions(+), 6 deletions(-) create mode 100644 tensorflow/contrib/lite/kernels/internal/legacy_types.h (limited to 'tensorflow/contrib') diff --git a/tensorflow/contrib/lite/kernels/internal/BUILD b/tensorflow/contrib/lite/kernels/internal/BUILD index afb5ec05df..5c9ca6e910 100644 --- a/tensorflow/contrib/lite/kernels/internal/BUILD +++ b/tensorflow/contrib/lite/kernels/internal/BUILD @@ -49,6 +49,20 @@ cc_library( ], ) +cc_library( + name = "legacy_types", + srcs = [], + hdrs = [ + "compatibility.h", + "legacy_types.h", + "types.h", + ], + deps = [ + "//tensorflow/contrib/lite/kernels:op_macros", + "@com_google_absl//absl/base:core_headers", + ], +) + config_setting( name = "arm", values = { @@ -198,6 +212,7 @@ cc_library( ":strided_slice_logic", ":tensor_utils", ":types", + ":legacy_types", ":legacy_reference_base", ":round", "//third_party/eigen3", @@ -336,6 +351,7 @@ cc_library( ":quantization_util", ":round", ":strided_slice_logic", + ":legacy_types", ":types", "@gemmlowp", "//tensorflow/contrib/lite/c:c_api_internal", diff --git a/tensorflow/contrib/lite/kernels/internal/legacy_types.h b/tensorflow/contrib/lite/kernels/internal/legacy_types.h new file mode 100644 index 0000000000..2e4d3137f5 --- /dev/null +++ b/tensorflow/contrib/lite/kernels/internal/legacy_types.h @@ -0,0 +1,26 @@ +/* Copyright 2018 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. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ +#ifndef TENSORFLOW_CONTRIB_LITE_KERNELS_INTERNAL_LEGACY_TYPES_H_ +#define TENSORFLOW_CONTRIB_LITE_KERNELS_INTERNAL_LEGACY_TYPES_H_ + +#include "tensorflow/contrib/lite/kernels/internal/types.h" + +namespace tflite { + +// TODO(b/116772710): Insert legacy Dims<> code in here. + +} // namespace tflite + +#endif // TENSORFLOW_CONTRIB_LITE_KERNELS_INTERNAL_LEGACY_TYPES_H_ diff --git a/tensorflow/contrib/lite/kernels/internal/reference/legacy_reference_ops.h b/tensorflow/contrib/lite/kernels/internal/reference/legacy_reference_ops.h index be99240b1f..c8b64cfd96 100644 --- a/tensorflow/contrib/lite/kernels/internal/reference/legacy_reference_ops.h +++ b/tensorflow/contrib/lite/kernels/internal/reference/legacy_reference_ops.h @@ -19,10 +19,10 @@ limitations under the License. #include #include "tensorflow/contrib/lite/kernels/internal/common.h" +#include "tensorflow/contrib/lite/kernels/internal/legacy_types.h" #include "tensorflow/contrib/lite/kernels/internal/reference/depthwiseconv_float.h" #include "tensorflow/contrib/lite/kernels/internal/reference/depthwiseconv_uint8.h" #include "tensorflow/contrib/lite/kernels/internal/reference/reference_ops.h" -#include "tensorflow/contrib/lite/kernels/internal/types.h" namespace tflite { @@ -30,6 +30,11 @@ namespace reference_ops { static constexpr int kDepthwiseReverseShift = -1; +inline void ShapeFromDims(const tflite::Dims<4>& dims, RuntimeShape* shape) { + shape->BuildFrom( + {dims.sizes[3], dims.sizes[2], dims.sizes[1], dims.sizes[0]}); +} + inline void DepthwiseConv(const float* input_data, const Dims<4>& input_dims, const float* filter_data, const Dims<4>& filter_dims, const float* bias_data, const Dims<4>& bias_dims, diff --git a/tensorflow/contrib/lite/kernels/internal/reference/reference_ops.h b/tensorflow/contrib/lite/kernels/internal/reference/reference_ops.h index 59f17ae854..19d23fa80b 100644 --- a/tensorflow/contrib/lite/kernels/internal/reference/reference_ops.h +++ b/tensorflow/contrib/lite/kernels/internal/reference/reference_ops.h @@ -100,11 +100,6 @@ gemmlowp::FixedPoint SaturatingSub( namespace reference_ops { -inline void ShapeFromDims(const tflite::Dims<4>& dims, RuntimeShape* shape) { - shape->BuildFrom( - {dims.sizes[3], dims.sizes[2], dims.sizes[1], dims.sizes[0]}); -} - template int CountLeadingZeros(T integer_input) { static_assert(std::is_unsigned::value, -- cgit v1.2.3