Skip to content

Commit

Permalink
Build fixes for TensorFlow 2.13.0
Browse files Browse the repository at this point in the history
  • Loading branch information
0x8000-0000 committed Aug 13, 2023
1 parent 6589d0b commit 32f9917
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 30 deletions.
2 changes: 1 addition & 1 deletion WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ load("@org_tensorflow//tensorflow:workspace0.bzl", "tf_workspace0")
tf_workspace0()

load("@coral_crosstool//:configure.bzl", "cc_crosstool")
cc_crosstool(name = "crosstool", cpp_version = "c++14")
cc_crosstool(name = "crosstool", cpp_version = "c++17")

# External Dependencies
http_archive(
Expand Down
9 changes: 5 additions & 4 deletions coral/detection/adapter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,12 @@ std::vector<Object> GetDetectionResults(const tflite::Interpreter& interpreter,
// If a model has signature, we use the signature output tensor names to parse
// the results. Otherwise, we parse the results based on some assumption of
// the output tensor order and size.
if (!interpreter.signature_def_names().empty()) {
CHECK_EQ(interpreter.signature_def_names().size(), 1);
VLOG(1) << "Signature name: " << *interpreter.signature_def_names()[0];
const auto interpreter_signature_keys = interpreter.signature_keys();
if (!interpreter_signature_keys.empty()) {
CHECK_EQ(interpreter_signature_keys.size(), 1);
VLOG(1) << "Signature name: " << *interpreter_signature_keys[0];
const auto& signature_output_map = interpreter.signature_outputs(
interpreter.signature_def_names()[0]->c_str());
interpreter_signature_keys[0]->c_str());
CHECK_EQ(signature_output_map.size(), 4);
count = TensorData<float>(
*interpreter.tensor(signature_output_map.at("output_0")));
Expand Down
14 changes: 0 additions & 14 deletions coral/pipeline/internal/segment_runner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,6 @@ limitations under the License.
namespace coral {
namespace internal {
namespace {
TfLiteFloatArray* TfLiteFloatArrayCopy(const TfLiteFloatArray* src) {
if (!src) {
return nullptr;
}
TfLiteFloatArray* ret = static_cast<TfLiteFloatArray*>(
std::malloc(TfLiteFloatArrayGetSizeInBytes(src->size)));
if (!ret) {
return nullptr;
}
ret->size = src->size;
std::memcpy(ret->data, src->data, src->size * sizeof(float));
return ret;
}

void DmaDelegateFreeBufferHandle(TfLiteContext* context,
struct TfLiteDelegate* delegate,
TfLiteBufferHandle* handle) {
Expand Down
11 changes: 0 additions & 11 deletions coral/tflite_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,6 @@ limitations under the License.

namespace coral {
namespace {
TfLiteFloatArray* TfLiteFloatArrayCopy(const TfLiteFloatArray* src) {
if (!src) return nullptr;

auto* copy = static_cast<TfLiteFloatArray*>(
malloc(TfLiteFloatArrayGetSizeInBytes(src->size)));
CHECK(copy);
copy->size = src->size;
std::memcpy(copy->data, src->data, src->size * sizeof(float));
return copy;
}

TfLiteAffineQuantization* TfLiteAffineQuantizationCopy(
const TfLiteAffineQuantization* src) {
if (!src) return nullptr;
Expand Down

0 comments on commit 32f9917

Please sign in to comment.