Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build fixes for TensorFlow 2.13.0 #35

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
2 changes: 1 addition & 1 deletion coral/learn/backprop/layers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ MatrixXf CrossEntropyGradient(const MatrixXf& c, const MatrixXf& p) {
MatrixXf FullyConnected(const MatrixXf& mat_x, const MatrixXf& mat_w,
const MatrixXf& mat_b) {
MatrixXf mat_y = mat_x * mat_w;
mat_y.array().rowwise() += mat_b.array()(0, Eigen::all);
mat_y.array().rowwise() += mat_b.array()(0, Eigen::indexing::all);
return mat_y;
}

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