Removed unused functionality.

PiperOrigin-RevId: 357012002
Change-Id: Ibe7260bae6d40af482864e74748da9db4437b7f6
This commit is contained in:
Raman Sarokin 2021-02-11 10:54:20 -08:00 committed by TensorFlower Gardener
parent cc8e4a4002
commit 8c81fcdae9
3 changed files with 0 additions and 121 deletions

View File

@ -615,16 +615,6 @@ objc_library(
],
)
cc_library(
name = "util",
srcs = ["util.cc"],
hdrs = ["util.h"],
deps = [
"//tensorflow/lite/delegates/gpu/common:data_type",
"//tensorflow/lite/delegates/gpu/common:types",
],
)
objc_library(
name = "winograd_test_lib",
testonly = 1,

View File

@ -1,57 +0,0 @@
/* Copyright 2021 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.
==============================================================================*/
#include "tensorflow/lite/delegates/gpu/metal/kernels/util.h"
#include <vector>
#include "tensorflow/lite/delegates/gpu/common/types.h"
namespace tflite {
namespace gpu {
namespace metal {
/// Converts float to destination type (if needed) and stores as bytes array.
std::vector<uint8_t> GetByteBufferConverted(
const std::vector<float>& input_vector, DataType data_type) {
if (data_type == DataType::FLOAT32) {
return GetByteBuffer(input_vector);
} else {
std::vector<uint8_t> result;
result.reserve(input_vector.size() * sizeof(half));
for (const float value : input_vector) {
const half converted = half(value);
const uint8_t* bytes = reinterpret_cast<const uint8_t*>(&converted);
result.insert(result.end(), bytes, bytes + sizeof(half));
}
return result;
}
}
/// Resizes, Converts float to destination type (if needed) and stores as bytes
/// array.
std::vector<uint8_t> GetByteBufferConvertedResized(
const std::vector<float>& input_vector, DataType data_type,
size_t elements_count) {
auto result = GetByteBufferConverted(input_vector, data_type);
const size_t type_size =
data_type == DataType::FLOAT32 ? sizeof(float) : sizeof(half);
result.resize(type_size * elements_count);
return result;
}
} // namespace metal
} // namespace gpu
} // namespace tflite

View File

@ -1,54 +0,0 @@
/* Copyright 2021 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_LITE_DELEGATES_GPU_METAL_KERNELS_UTIL_H_
#define TENSORFLOW_LITE_DELEGATES_GPU_METAL_KERNELS_UTIL_H_
#include <vector>
#include "tensorflow/lite/delegates/gpu/common/data_type.h"
namespace tflite {
namespace gpu {
namespace metal {
/// Helper function to convert buffer's content into stream of bytes
template <typename T>
std::vector<uint8_t> GetByteBuffer(const std::vector<T>& input_vector) {
std::vector<uint8_t> result;
result.insert(result.begin(),
reinterpret_cast<const uint8_t*>(input_vector.data()),
reinterpret_cast<const uint8_t*>(input_vector.data()) +
input_vector.size() * sizeof(*input_vector.data()));
return result;
}
/// Converts float to destination type (if needed) and stores as bytes array.
/// supports DataType::FLOAT32 and DataType::FLOAT16
std::vector<uint8_t> GetByteBufferConverted(
const std::vector<float>& input_vector, DataType data_type);
/// Resizes, Converts float to destination type (if needed) and stores as bytes
/// array.
/// supports DataType::FLOAT32 and DataType::FLOAT16
std::vector<uint8_t> GetByteBufferConvertedResized(
const std::vector<float>& input_vector, DataType data_type,
size_t elements_count);
} // namespace metal
} // namespace gpu
} // namespace tflite
#endif // TENSORFLOW_LITE_DELEGATES_GPU_METAL_KERNELS_UTIL_H_