From 063e365d7679c6dd7f2f18009f4bfff51fca435c Mon Sep 17 00:00:00 2001 From: FabianThomsen <56032277+FabianThomsen@users.noreply.github.com> Date: Thu, 22 Jun 2023 10:33:42 +0200 Subject: [PATCH 1/2] Make Model::operator() calls const --- include/tensorflow_cpp/model.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/tensorflow_cpp/model.h b/include/tensorflow_cpp/model.h index f6e585f..46a4e09 100644 --- a/include/tensorflow_cpp/model.h +++ b/include/tensorflow_cpp/model.h @@ -162,7 +162,7 @@ class Model { */ std::unordered_map operator()( const std::vector>& inputs, - const std::vector& output_names) { + const std::vector& output_names) const{ // properly set input/output names for session->Run() std::vector> input_nodes; @@ -170,9 +170,9 @@ class Model { if (is_saved_model_) { for (const auto& input : inputs) input_nodes.push_back( - {saved_model_layer2node_[input.first], input.second}); + {saved_model_layer2node_.find(input.first)->second, input.second}); for (const auto& name : output_names) - output_node_names.push_back(saved_model_layer2node_[name]); + output_node_names.push_back(saved_model_layer2node_.find(name)->second); } else if (is_frozen_graph_) { input_nodes = inputs; output_node_names = output_names; @@ -207,7 +207,7 @@ class Model { * * @return tf::Tensor output tensor */ - tf::Tensor operator()(const tf::Tensor& input_tensor) { + tf::Tensor operator()(const tf::Tensor& input_tensor) const { if (n_inputs_ != 1 || n_outputs_ != 1) { throw std::runtime_error( @@ -235,7 +235,7 @@ class Model { * @return std::vector output tensors */ std::vector operator()( - const std::vector& input_tensors) { + const std::vector& input_tensors) const { if (input_tensors.size() != n_inputs_) { throw std::runtime_error( From 08858eaf6bb0b48c1fb3f427cd25245988ea110d Mon Sep 17 00:00:00 2001 From: FabianThomsen <56032277+FabianThomsen@users.noreply.github.com> Date: Thu, 22 Jun 2023 10:42:02 +0200 Subject: [PATCH 2/2] Bump version to 1.0.6 --- CMakeLists.txt | 2 +- doc/Doxyfile | 2 +- package.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d939d73..3682a2e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.8) -project(tensorflow_cpp VERSION 1.0.5 LANGUAGES CXX) +project(tensorflow_cpp VERSION 1.0.6 LANGUAGES CXX) find_package(ros_environment QUIET) if(ros_environment_FOUND) diff --git a/doc/Doxyfile b/doc/Doxyfile index 31a8653..9deab5d 100644 --- a/doc/Doxyfile +++ b/doc/Doxyfile @@ -5,7 +5,7 @@ #--------------------------------------------------------------------------- # DOXYFILE_ENCODING = UTF-8 PROJECT_NAME = "tensorflow_cpp" -PROJECT_NUMBER = 1.0.5 +PROJECT_NUMBER = 1.0.6 # PROJECT_BRIEF = # PROJECT_LOGO = # OUTPUT_DIRECTORY = diff --git a/package.xml b/package.xml index 35d476f..4cc213c 100644 --- a/package.xml +++ b/package.xml @@ -2,7 +2,7 @@ tensorflow_cpp - 1.0.5 + 1.0.6 Wrappers around the TensorFlow C++ API for easy usage in ROS Lennart Reiher