Closed rdube closed 7 years ago
I am using python version 2.7.6, tensorflow version 1.0.0-rc2 and gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4. Can the gcc version be the issue?
I'd first try upgrading to gcc 4.9. It did not hurt anything on my Ubuntu 14.04.
And I use Tensorflow 1.1.0.
Thanks! It looks like the problem lays in having dependencies on two different eigen whereas your example does not use eigen. I will try building a simple non-eigen dependent package around your TensorflowGraphExecutor
Yes, that's what I do (because of requirements for different Protobuf versions).
You basically build the graph executor standalone and use private (forward) declarations of everything from Tensorflow in the .h file, so that you no longer have to include the TF headers to use the executor class.
Ok it is now compiling! Now I just have to transfer all our preprocessing python code into c++ and cross my fingers that the model can actually be used! :-)
Thanks!
@peci1 could you please elaborate how did you solve the conflict by forward declaration? I tried the following:
// inference.cc
#include <"tensorflow/core/public/session.h">
class Inferencer {
void infernce(); // where sess.run is called
}
// detector.cc
class Inferencer; // forward declaration
class Detector {
void detector() {
Inferencer inferencer;
inferencer.inference() // this is not allowed because Inferencer has incomplete type
}
}
As you will expect, inferencer.inference()
will cause compiler error since Inferencer
has incomplete type. How did you use forward declaration to solve this problem? Thanks in advance.
@stomachacheGE You have to use PIMPL or a similar idiom: https://cpppatterns.com/patterns/pimpl.html . You cannot have a variable with incomplete type, but you can have a pointer to incomplete type (in PIMPL case a std::unique_ptr
).
Hi @peci1 thanks a lot for making this available! :)
I compiled tensorflow_ros and added it in the
package.xml
of my catkin package as depend.Then I added these two includes in my file :
And am getting this compilation error:
Have you seen this before? Any idea?