Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

*** Break *** segmentation violation ( with tensorflow c++ )

Hi pros I'm a newbie here.

I'm currently facing a weird segmentaion violation .

For academic research , i'm going to use neural network to do some predictions with a simulator.

What i am trying to do is loading a pre-trained model which is converted to .pb file , then making predictions.

My computer setup up is : Ubuntu 16.04 LTS compiler: Scons with g++ , using c++14 No Gpu , only Cpu.

Here are the errors that i got :

  *** Break *** segmentation violation

There was a crash.
This is the entire stack trace of all threads:
    ===========================================================

Thread 2 (Thread 0x7effda40a700 (LWP 2546)):
#0  0x00007efff0531709 in pthread_cond_timedwait

GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0
#1  0x00007efff08a894c in PyCOND_TIMEDWAIT (cond=0x7efff0c63e20 <gil_cond>, mut=0x7efff0c63de0 <gil_mutex>, us=<optimized out>) at /cvmfs/belle.cern.ch/ubuntu1604/externals/v01-06-01/src/python/Python/condvar.h:103
#2  take_gil (tstate=tstate
entry=0x6c59ed0) at /cvmfs/belle.cern.ch/ubuntu1604/externals/v01-06-01/src/python/Python/ceval_gil.h:224
#3  0x00007efff08a8ea9 in PyEval_RestoreThread (tstate=tstate
entry=0x6c59ed0) at /cvmfs/belle.cern.ch/ubuntu1604/externals/v01-06-01/src/python/Python/ceval.c:368
#4  0x00007efff0930cb3 in pysleep (secs=<optimized out>) at /cvmfs/belle.cern.ch/ubuntu1604/externals/v01-06-01/src/python/Modules/timemodule.c:1439
#5  time_sleep (self=<optimized out>, obj=<optimized out>) at /cvmfs/belle.cern.ch/ubuntu1604/externals/v01-06-01/src/python/Modules/timemodule.c:235
#6  0x00007efff081de66 in _PyCFunction_FastCallDict (func_obj=0x7effde2daa20, args=0x7effd4001240, nargs=1, kwargs=kwargs
entry=0x0) at /cvmfs/belle.cern.ch/ubuntu1604/externals/v01-06-01/src/python/Objects/methodobject.c:209
#7  0x00007efff081e163 in _PyCFunction_FastCallKeywords (func=func
entry=0x7effde2daa20, stack=<optimized out>, nargs=nargs
entry=1, kwnames=kwnames
entry=0x0) at /cvmfs/belle.cern.ch/ubuntu1604/externals/v01-06-01/src/python/Objects/methodobject.c:294
#8  0x00007efff08aa09f in call_function (pp_stack=pp_stack
entry=0x7effda404310, oparg=<optimized out>, kwnames=kwnames
entry=0x0) at /cvmfs/belle.cern.ch/ubuntu1604/externals/v01-06-01/src/python/Python/ceval.c:4809
#9  0x00007efff08acb62 in _PyEval_EvalFrameDefault (f=<optimized out>, throwflag=<optimized out>) at /cvmfs/belle.cern.ch/ubuntu1604/externals/v01-06-01/src/python/Python/ceval.c:3295
#10 0x00007efff08a9c9a in _PyEval_EvalCodeWithName (_co=0x7effdfbd44b0, globals=<optimized out>, locals=locals
entry=0x0, args=args
entry=0x7effdfb84bf8, argcount=1, kwnames=kwnames
entry=0x7effdf167060, kwargs=0x7effdf167068, kwcount=0, kwstep=2, defs=0x0, defcount=0, kwdefs=0x0, closure=0x0, name=0x0, qualname=0x0) at /cvmfs/belle.cern.ch/ubuntu1604/externals/v01-06-01/src/python/Python/ceval.c:4139
#11 0x00007efff08aa2ef in PyEval_EvalCodeEx (_co=<optimized out>, globals=<optimized out>, locals=locals
entry=0x0, args=args
entry=0x7effdfb84bf8, argcount=<optimized out>, kws=kws
entry=0x7effdf167060, kwcount=0, defs=0x0, defcount=0, kwdefs=0x0, closure=0x0) at /cvmfs/belle.cern.ch/ubuntu1604/externals/v01-06-01/src/python/Python/ceval.c:4160
#12 0x00007efff07e7dcd in function_call (func=0x7effdfb861e0, arg=0x7effdfb84be0, kw=0x7effdfb83ee8) at /cvmfs/belle.cern.ch/ubuntu1604/externals/v01-06-01/src/python/Objects/funcobject.c:604
#13 0x00007efff07b62a8 in PyObject_Call (func=0x7effdfb861e0, args=<optimized out>, kwargs=<optimized out>) at /cvmfs/belle.cern.ch/ubuntu1604/externals/v01-06-01/src/python/Objects/abstract.c:2246
#14 0x00007efff08ac83c in do_call_core (kwdict=0x7effdfb83ee8, callargs=0x7effdfb84be0, func=0x7effdfb861e0) at /cvmfs/belle.cern.ch/ubuntu1604/externals/v01-06-01/src/python/Python/ceval.c:5078
#15 _PyEval_EvalFrameDefault (f=<optimized out>, throwflag=<optimized out>) at /cvmfs/belle.cern.ch/ubuntu1604/externals/v01-06-01/src/python/Python/ceval.c:3377
#16 0x00007efff08aa299 in _PyFunction_FastCall (globals=<optimized out>, nargs=1, args=<optimized out>, co=<optimized out>) at /cvmfs/belle.cern.ch/ubuntu1604/externals/v01-06-01/src/python/Python/ceval.c:4891
#17 fast_function (kwnames=0x0, nargs=1, stack=0x7effd4000a70, func=0x7effdfbc1bf8) at /cvmfs/belle.cern.ch/ubuntu1604/externals/v01-06-01/src/python/Python/ceval.c:4926
#18 call_function (pp_stack=pp_stack
entry=0x7effda4047c0, oparg=<optimized out>, kwnames=kwnames
entry=0x0) at /cvmfs/belle.cern.ch/ubuntu1604/externals/v01-06-01/src/python/Python/ceval.c:4830
#19 0x00007efff08acb62 in _PyEval_EvalFrameDefault (f=<optimized out>, throwflag=<optimized out>) at /cvmfs/belle.cern.ch/ubuntu1604/externals/v01-06-01/src/python/Python/ceval.c:3295
#20 0x00007efff08aa299 in _PyFunction_FastCall (globals=<optimized out>, nargs=1, args=<optimized out>, co=<optimized out>) at /cvmfs/belle.cern.ch/ubuntu1604/externals/v01-06-01/src/python/Python/ceval.c:4891
#21 fast_function (kwnames=0x0, nargs=1, stack=0x7effde7dff20, func=0x7effdfbc1e18) at /cvmfs/belle.cern.ch/ubuntu1604/externals/v01-06-01/src/python/Python/ceval.c:4926
#22 call_function (pp_stack=pp_stack
entry=0x7effda404930, oparg=<optimized out>, kwnames=kwnames
entry=0x0) at /cvmfs/belle.cern.ch/ubuntu1604/externals/v01-06-01/src/python/Python/ceval.c:4830
#23 0x00007efff08acb62 in _PyEval_EvalFrameDefault (f=<optimized out>, throwflag=<optimized out>) at /cvmfs/belle.cern.ch/ubuntu1604/externals/v01-06-01/src/python/Python/ceval.c:3295
#24 0x00007efff08b28cf in _PyFunction_FastCall (globals=0x7effde2e3ee8, nargs=1, args=<optimized out>, co=0x7effdfbabf60) at /cvmfs/belle.cern.ch/ubuntu1604/externals/v01-06-01/src/python/Python/ceval.c:4891
#25 _PyFunction_FastCallDict (func=func
entry=0x7effdfbc1c80, args=args
entry=0x7effda404aa0, nargs=1, kwargs=kwargs
entry=0x0) at /cvmfs/belle.cern.ch/ubuntu1604/externals/v01-06-01/src/python/Python/ceval.c:4993
#26 0x00007efff07b64de in _PyObject_FastCallDict (func=func
entry=0x7effdfbc1c80, args=args
entry=0x7effda404aa0, nargs=nargs
entry=1, kwargs=kwargs
entry=0x0) at /cvmfs/belle.cern.ch/ubuntu1604/externals/v01-06-01/src/python/Objects/abstract.c:2295
#27 0x00007efff07b65dd in _PyObject_Call_Prepend (func=0x7effdfbc1c80, obj=<optimized out>, args=0x7effdf167048, kwargs=0x0) at /cvmfs/belle.cern.ch/ubuntu1604/externals/v01-06-01/src/python/Objects/abstract.c:2358
#28 0x00007efff07b62a8 in PyObject_Call (func=0x7effdf15d908, args=<optimized out>, kwargs=<optimized out>) at /cvmfs/belle.cern.ch/ubuntu1604/externals/v01-06-01/src/python/Objects/abstract.c:2246
#29 0x00007efff08aa721 in PyEval_CallObjectWithKeywords (func=<optimized out>, args=<optimized out>, kwargs=<optimized out>) at /cvmfs/belle.cern.ch/ubuntu1604/externals/v01-06-01/src/python/Python/ceval.c:4729
#30 0x00007efff08fee92 in t_bootstrap (boot_raw=0x7effdf0c9968) at /cvmfs/belle.cern.ch/ubuntu1604/externals/v01-06-01/src/python/Modules/_threadmodule.c:998
#31 0x00007efff052b6ba in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#32 0x00007effefcca41d in clone () from /lib/x86_64-linux-gnu/libc.so.6

Thread 1 (Thread 0x7efff1cdaac0 (LWP 2516)):
#0  0x00007effefc8f0cb in waitpid () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x00007effefc07fbb in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#2  0x00007effef877129 in TUnixSystem::StackTrace() () from /opt/basf2/externals/v01-06-01/Linux_x86_64/opt/root/lib/libCore.so
#3  0x00007effef8795dc in TUnixSystem::DispatchSignals(ESignals) () from /opt/basf2/externals/v01-06-01/Linux_x86_64/opt/root/lib/libCore.so
#4  <signal handler called>
#5  0x00007effb776b2f8 in LoadGraph(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::unique_ptr<tensorflow::Session, std::default_delete<tensorflow::Session> >*) () from /home/ooohellno/Desktop/basf2/research4/modules/Linux_x86_64/opt/libresearch4.so
#6  0x00007effb776b60b in model::load_models(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) () from /home/ooohellno/Desktop/basf2/research4/modules/Linux_x86_64/opt/libresearch4.so
#7  0x00007effb775aae5 in Belle2::ParticleLoaderModule::initialize() () from /home/ooohellno/Desktop/basf2/research4/modules/Linux_x86_64/opt/libresearch4.so
#8  0x00007efff16861fd in Belle2::EventProcessor::processInitialize(std::__cxx11::list<std::shared_ptr<Belle2::Module>, std::allocator<std::shared_ptr<Belle2::Module> > > const&, bool) () from /opt/basf2/releases/release-02-00-01/lib/Linux_x86_64/opt/libframework.so
#9  0x00007efff168ca46 in Belle2::EventProcessor::process(std::shared_ptr<Belle2::Path>, long) () from /opt/basf2/releases/release-02-00-01/lib/Linux_x86_64/opt/libframework.so
#10 0x00007effdeadf559 in Belle2::Framework::process(std::shared_ptr<Belle2::Path>, long) () from /opt/basf2/releases/release-02-00-01/lib/Linux_x86_64/opt/pybasf2.so
#11 0x00007effdeae6d32 in process_overloads::non_void_return_type::gen<boost::mpl::vector4<void, Belle2::Framework&, std::shared_ptr<Belle2::Path>, long> >::func_0(Belle2::Framework&, std::shared_ptr<Belle2::Path>) () from /opt/basf2/releases/release-02-00-01/lib/Linux_x86_64/opt/pybasf2.so
#12 0x00007effdeae4efc in boost::python::objects::caller_py_function_impl<boost::python::detail::caller<void (*)(Belle2::Framework&, std::shared_ptr<Belle2::Path>), boost::python::default_call_policies, boost::mpl::vector3<void, Belle2::Framework&, std::shared_ptr<Belle2::Path> > > >::operator()(_object*, _object*) () from /opt/basf2/releases/release-02-00-01/lib/Linux_x86_64/opt/pybasf2.so
#13 0x00007efff0ea4315 in boost::python::objects::function::call(_object*, _object*) const () from /opt/basf2/externals/v01-06-01/Linux_x86_64/common/lib64/libboost_python3.so.1.64.0
#14 0x00007efff0ea44d8 in boost::detail::function::void_function_ref_invoker0<boost::python::objects::(anonymous namespace)::bind_return, void>::invoke(boost::detail::function::function_buffer&) () from /opt/basf2/externals/v01-06-01/Linux_x86_64/common/lib64/libboost_python3.so.1.64.0
#15 0x00007efff0eaadeb in boost::python::detail::exception_handler::operator()(boost::function0<void> const&) const () from /opt/basf2/externals/v01-06-01/Linux_x86_64/common/lib64/libboost_python3.so.1.64.0
#16 0x00007effdeae29b3 in boost::detail::function::function_obj_invoker2<boost::_bi::bind_t<bool, boost::python::detail::translate_exception<Belle2::ModuleManager::ModuleNotCreatedError, void (*)(Belle2::ModuleManager::ModuleNotCreatedError const&)>, boost::_bi::list3<boost::arg<1>, boost::arg<2>, boost::_bi::value<void (*)(Belle2::ModuleManager::ModuleNotCreatedError const&)> > >, bool, boost::python::detail::exception_handler const&, boost::function0<void> const&>::invoke(boost::detail::function::function_buffer&, boost::python::detail::exception_handler const&, boost::function0<void> const&) () from /opt/basf2/releases/release-02-00-01/lib/Linux_x86_64/opt/pybasf2.so
#17 0x00007efff0eaabbf in boost::python::handle_exception_impl(boost::function0<void>) () from /opt/basf2/externals/v01-06-01/Linux_x86_64/common/lib64/libboost_python3.so.1.64.0
#18 0x00007efff0ea1cd9 in function_call () from /opt/basf2/externals/v01-06-01/Linux_x86_64/common/lib64/libboost_python3.so.1.64.0
#19 0x00007efff07b6419 in _PyObject_FastCallDict (func=0x3265c70, args=<optimized out>, nargs=<optimized out>, kwargs=kwargs
entry=0x0) at /cvmfs/belle.cern.ch/ubuntu1604/externals/v01-06-01/src/python/Objects/abstract.c:2316
#20 0x00007efff07b6891 in _PyObject_FastCallKeywords (func=func
entry=0x3265c70, stack=stack
entry=0xd086048, nargs=nargs
entry=2, kwnames=kwnames
entry=0x0) at /cvmfs/belle.cern.ch/ubuntu1604/externals/v01-06-01/src/python/Objects/abstract.c:2481
#21 0x00007efff08a9df9 in call_function (pp_stack=pp_stack
entry=0x7ffdd6154240, oparg=<optimized out>, kwnames=kwnames
entry=0x0) at /cvmfs/belle.cern.ch/ubuntu1604/externals/v01-06-01/src/python/Python/ceval.c:4833
#22 0x00007efff08acb62 in _PyEval_EvalFrameDefault (f=<optimized out>, throwflag=<optimized out>) at /cvmfs/belle.cern.ch/ubuntu1604/externals/v01-06-01/src/python/Python/ceval.c:3295
#23 0x00007efff08a9c9a in _PyEval_EvalCodeWithName (_co=0x7effded36a50, globals=<optimized out>, locals=locals
entry=0x0, args=args
entry=0x7effdf14fba0, argcount=argcount
entry=1, kwnames=0x0, kwargs=0x7effdf14fba8, kwcount=0, kwstep=1, defs=0x7effded550d0, defcount=1, kwdefs=0x0, closure=0x0, name=0x7effded43688, qualname=0x7effded43688) at /cvmfs/belle.cern.ch/ubuntu1604/externals/v01-06-01/src/python/Python/ceval.c:4139
#24 0x00007efff08a9f32 in fast_function (kwnames=0x0, nargs=1, stack=0x7effdf14fba0, func=0x7effdfbcb400) at /cvmfs/belle.cern.ch/ubuntu1604/externals/v01-06-01/src/python/Python/ceval.c:4950
#25 call_function (pp_stack=pp_stack
entry=0x7ffdd61544e0, oparg=<optimized out>, kwnames=kwnames
entry=0x0) at /cvmfs/belle.cern.ch/ubuntu1604/externals/v01-06-01/src/python/Python/ceval.c:4830
#26 0x00007efff08acb62 in _PyEval_EvalFrameDefault (f=<optimized out>, throwflag=<optimized out>) at /cvmfs/belle.cern.ch/ubuntu1604/externals/v01-06-01/src/python/Python/ceval.c:3295
#27 0x00007efff08a9c9a in _PyEval_EvalCodeWithName (_co=_co
entry=0x7effdf06da50, globals=globals
entry=0x7effdf1243a8, locals=locals
entry=0x7effdf1243a8, args=args
entry=0x0, argcount=argcount
entry=0, kwnames=kwnames
entry=0x0, kwargs=0x8, kwcount=0, kwstep=2, defs=0x0, defcount=0, kwdefs=0x0, closure=0x0, name=0x0, qualname=0x0) at /cvmfs/belle.cern.ch/ubuntu1604/externals/v01-06-01/src/python/Python/ceval.c:4139
#28 0x00007efff08aa2ef in PyEval_EvalCodeEx (_co=_co
entry=0x7effdf06da50, globals=globals
entry=0x7effdf1243a8, locals=locals
entry=0x7effdf1243a8, args=args
entry=0x0, argcount=argcount
entry=0, kws=kws
entry=0x0, kwcount=0, defs=0x0, defcount=0, kwdefs=0x0, closure=0x0) at /cvmfs/belle.cern.ch/ubuntu1604/externals/v01-06-01/src/python/Python/ceval.c:4160
#29 0x00007efff08aa31b in PyEval_EvalCode (co=co
entry=0x7effdf06da50, globals=globals
entry=0x7effdf1243a8, locals=locals
entry=0x7effdf1243a8) at /cvmfs/belle.cern.ch/ubuntu1604/externals/v01-06-01/src/python/Python/ceval.c:695
#30 0x00007efff08de56a in run_mod (arena=0x7effdf1382e8, flags=0x0, locals=0x7effdf1243a8, globals=0x7effdf1243a8, filename=0x7effded34100, mod=0x32f4a40) at /cvmfs/belle.cern.ch/ubuntu1604/externals/v01-06-01/src/python/Python/pythonrun.c:980
#31 PyRun_FileExFlags (fp=<optimized out>, filename_str=<optimized out>, start=<optimized out>, globals=0x7effdf1243a8, locals=0x7effdf1243a8, closeit=0, flags=0x0) at /cvmfs/belle.cern.ch/ubuntu1604/externals/v01-06-01/src/python/Python/pythonrun.c:933
#32 0x00007efff0eaf275 in boost::python::exec_file(boost::python::str, boost::python::api::object, boost::python::api::object) () from /opt/basf2/externals/v01-06-01/Linux_x86_64/common/lib64/libboost_python3.so.1.64.0
#33 0x000000000040c159 in main ()
===========================================================


The lines below might hint at the cause of the crash.
You may get help by asking at the ROOT forum http://root.cern.ch/forum.
Only if you are really convinced it is a bug in ROOT then please submit a
report at http://root.cern.ch/bugs. Please post the ENTIRE stack trace
from above as an attachment in addition to anything else
that might help us fixing this issue.
===========================================================
#5  0x00007effb776b2f8 in LoadGraph(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::unique_ptr<tensorflow::Session, std::default_delete<tensorflow::Session> >*) () from /home/ooohellno/Desktop/basf2/research4/modules/Linux_x86_64/opt/libresearch4.so
#6  0x00007effb776b60b in model::load_models(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) () from /home/ooohellno/Desktop/basf2/research4/modules/Linux_x86_64/opt/libresearch4.so
#7  0x00007effb775aae5 in Belle2::ParticleLoaderModule::initialize() () from /home/ooohellno/Desktop/basf2/research4/modules/Linux_x86_64/opt/libresearch4.so
#8  0x00007efff16861fd in Belle2::EventProcessor::processInitialize(std::__cxx11::list<std::shared_ptr<Belle2::Module>, std::allocator<std::shared_ptr<Belle2::Module> > > const&, bool) () from /opt/basf2/releases/release-02-00-01/lib/Linux_x86_64/opt/libframework.so
#9  0x00007efff168ca46 in Belle2::EventProcessor::process(std::shared_ptr<Belle2::Path>, long) () from /opt/basf2/releases/release-02-00-01/lib/Linux_x86_64/opt/libframework.so
#10 0x00007effdeadf559 in Belle2::Framework::process(std::shared_ptr<Belle2::Path>, long) () from /opt/basf2/releases/release-02-00-01/lib/Linux_x86_64/opt/pybasf2.so
#11 0x00007effdeae6d32 in process_overloads::non_void_return_type::gen<boost::mpl::vector4<void, Belle2::Framework&, std::shared_ptr<Belle2::Path>, long> >::func_0(Belle2::Framework&, std::shared_ptr<Belle2::Path>) () from /opt/basf2/releases/release-02-00-01/lib/Linux_x86_64/opt/pybasf2.so
#12 0x00007effdeae4efc in boost::python::objects::caller_py_function_impl<boost::python::detail::caller<void (*)(Belle2::Framework&, std::shared_ptr<Belle2::Path>), boost::python::default_call_policies, boost::mpl::vector3<void, Belle2::Framework&, std::shared_ptr<Belle2::Path> > > >::operator()(_object*, _object*) () from /opt/basf2/releases/release-02-00-01/lib/Linux_x86_64/opt/pybasf2.so
#13 0x00007efff0ea4315 in boost::python::objects::function::call(_object*, _object*) const () from /opt/basf2/externals/v01-06-01/Linux_x86_64/common/lib64/libboost_python3.so.1.64.0
#14 0x00007efff0ea44d8 in boost::detail::function::void_function_ref_invoker0<boost::python::objects::(anonymous namespace)::bind_return, void>::invoke(boost::detail::function::function_buffer&) () from /opt/basf2/externals/v01-06-01/Linux_x86_64/common/lib64/libboost_python3.so.1.64.0
#15 0x00007efff0eaadeb in boost::python::detail::exception_handler::operator()(boost::function0<void> const&) const () from /opt/basf2/externals/v01-06-01/Linux_x86_64/common/lib64/libboost_python3.so.1.64.0
#16 0x00007effdeae29b3 in boost::detail::function::function_obj_invoker2<boost::_bi::bind_t<bool, boost::python::detail::translate_exception<Belle2::ModuleManager::ModuleNotCreatedError, void (*)(Belle2::ModuleManager::ModuleNotCreatedError const&)>, boost::_bi::list3<boost::arg<1>, boost::arg<2>, boost::_bi::value<void (*)(Belle2::ModuleManager::ModuleNotCreatedError const&)> > >, bool, boost::python::detail::exception_handler const&, boost::function0<void> const&>::invoke(boost::detail::function::function_buffer&, boost::python::detail::exception_handler const&, boost::function0<void> const&) () from /opt/basf2/releases/release-02-00-01/lib/Linux_x86_64/opt/pybasf2.so
#17 0x00007efff0eaabbf in boost::python::handle_exception_impl(boost::function0<void>) () from /opt/basf2/externals/v01-06-01/Linux_x86_64/common/lib64/libboost_python3.so.1.64.0
#18 0x00007efff0ea1cd9 in function_call () from /opt/basf2/externals/v01-06-01/Linux_x86_64/common/lib64/libboost_python3.so.1.64.0
#19 0x00007efff07b6419 in _PyObject_FastCallDict (func=0x3265c70, args=<optimized out>, nargs=<optimized out>, kwargs=kwargs
entry=0x0) at /cvmfs/belle.cern.ch/ubuntu1604/externals/v01-06-01/src/python/Objects/abstract.c:2316
#20 0x00007efff07b6891 in _PyObject_FastCallKeywords (func=func
entry=0x3265c70, stack=stack
entry=0xd086048, nargs=nargs
entry=2, kwnames=kwnames
entry=0x0) at /cvmfs/belle.cern.ch/ubuntu1604/externals/v01-06-01/src/python/Objects/abstract.c:2481
#21 0x00007efff08a9df9 in call_function (pp_stack=pp_stack
entry=0x7ffdd6154240, oparg=<optimized out>, kwnames=kwnames
entry=0x0) at /cvmfs/belle.cern.ch/ubuntu1604/externals/v01-06-01/src/python/Python/ceval.c:4833
#22 0x00007efff08acb62 in _PyEval_EvalFrameDefault (f=<optimized out>, throwflag=<optimized out>) at /cvmfs/belle.cern.ch/ubuntu1604/externals/v01-06-01/src/python/Python/ceval.c:3295
#23 0x00007efff08a9c9a in _PyEval_EvalCodeWithName (_co=0x7effded36a50, globals=<optimized out>, locals=locals
entry=0x0, args=args
entry=0x7effdf14fba0, argcount=argcount
entry=1, kwnames=0x0, kwargs=0x7effdf14fba8, kwcount=0, kwstep=1, defs=0x7effded550d0, defcount=1, kwdefs=0x0, closure=0x0, name=0x7effded43688, qualname=0x7effded43688) at /cvmfs/belle.cern.ch/ubuntu1604/externals/v01-06-01/src/python/Python/ceval.c:4139
#24 0x00007efff08a9f32 in fast_function (kwnames=0x0, nargs=1, stack=0x7effdf14fba0, func=0x7effdfbcb400) at /cvmfs/belle.cern.ch/ubuntu1604/externals/v01-06-01/src/python/Python/ceval.c:4950
#25 call_function (pp_stack=pp_stack
entry=0x7ffdd61544e0, oparg=<optimized out>, kwnames=kwnames
entry=0x0) at /cvmfs/belle.cern.ch/ubuntu1604/externals/v01-06-01/src/python/Python/ceval.c:4830
#26 0x00007efff08acb62 in _PyEval_EvalFrameDefault (f=<optimized out>, throwflag=<optimized out>) at /cvmfs/belle.cern.ch/ubuntu1604/externals/v01-06-01/src/python/Python/ceval.c:3295
#27 0x00007efff08a9c9a in _PyEval_EvalCodeWithName (_co=_co
entry=0x7effdf06da50, globals=globals
entry=0x7effdf1243a8, locals=locals
entry=0x7effdf1243a8, args=args
entry=0x0, argcount=argcount
entry=0, kwnames=kwnames
entry=0x0, kwargs=0x8, kwcount=0, kwstep=2, defs=0x0, defcount=0, kwdefs=0x0, closure=0x0, name=0x0, qualname=0x0) at /cvmfs/belle.cern.ch/ubuntu1604/externals/v01-06-01/src/python/Python/ceval.c:4139
#28 0x00007efff08aa2ef in PyEval_EvalCodeEx (_co=_co
entry=0x7effdf06da50, globals=globals
entry=0x7effdf1243a8, locals=locals
entry=0x7effdf1243a8, args=args
entry=0x0, argcount=argcount
entry=0, kws=kws
entry=0x0, kwcount=0, defs=0x0, defcount=0, kwdefs=0x0, closure=0x0) at /cvmfs/belle.cern.ch/ubuntu1604/externals/v01-06-01/src/python/Python/ceval.c:4160
#29 0x00007efff08aa31b in PyEval_EvalCode (co=co
entry=0x7effdf06da50, globals=globals
entry=0x7effdf1243a8, locals=locals
entry=0x7effdf1243a8) at /cvmfs/belle.cern.ch/ubuntu1604/externals/v01-06-01/src/python/Python/ceval.c:695
#30 0x00007efff08de56a in run_mod (arena=0x7effdf1382e8, flags=0x0, locals=0x7effdf1243a8, globals=0x7effdf1243a8, filename=0x7effded34100, mod=0x32f4a40) at /cvmfs/belle.cern.ch/ubuntu1604/externals/v01-06-01/src/python/Python/pythonrun.c:980
#31 PyRun_FileExFlags (fp=<optimized out>, filename_str=<optimized out>, start=<optimized out>, globals=0x7effdf1243a8, locals=0x7effdf1243a8, closeit=0, flags=0x0) at /cvmfs/belle.cern.ch/ubuntu1604/externals/v01-06-01/src/python/Python/pythonrun.c:933
#32 0x00007efff0eaf275 in boost::python::exec_file(boost::python::str, boost::python::api::object, boost::python::api::object) () from /opt/basf2/externals/v01-06-01/Linux_x86_64/common/lib64/libboost_python3.so.1.64.0
#33 0x000000000040c159 in main ()
===========================================================

///// code for .cc .h ////

class model{
 public:
  model();

  void load_models(std::string);

  void mapping_catcher(std::vector<double>);

  double predict();

  void close_session();
 private:

  std::unique_ptr<tensorflow::Session> session;

  double final_container[27][69];
  double mapping_container[144][69];
  int temp;
};



tensorflow::Status LoadGraph(const tensorflow::string& graph_file_name,std::unique_ptr<tensorflow::Session>* session );
tensorflow::SessionOptions GetSessionOptions();

model::model()
{
}




void model::load_models(std::string graph_dir)
{
  std::string graph       = graph_dir;
  std::string root_dir    = "";

  //session.reset(tensorflow::NewSession(GetSessionOptions()));


      tensorflow::string graph_path        = tensorflow::io::JoinPath(root_dir,graph);
      tensorflow::Status load_graph_status = LoadGraph(graph_path,&session);

      if(!load_graph_status.ok())
        {
          LOG(ERROR) << load_graph_status;
        }

    }


double model::predict()
{
  std::string input_layer = "cnn_inception";
  std::string output_layer= "output";  
  int x = 27;
  int y = 69;

  // create tensor
  tensorflow::Tensor input_tensor(tensorflow::DT_FLOAT,tensorflow::TensorShape({x,y}));
  auto input_tensor_mapped = input_tensor.tensor<float, 2>();

  /// start mapping to tensor ///
  for (int i = 0;i < x;i++)
    {
      for (int j = 0;j < y;j++)
    {
      input_tensor_mapped(i,j) = final_container[i][j]; 
    }
    }

  /// run through model
  std::vector<tensorflow::Tensor> outputs;                                     
  tensorflow::Status run_status = session->Run({{input_layer, input_tensor}},  // there is a bit variable problem ,
                                   {output_layer}, {}, &outputs);

  if (!run_status.ok())
    {
      LOG(ERROR) << "Running model failed: " << run_status;
    }
  tensorflow::Tensor* output = &outputs[0];
  auto output_convert = output->flat<float>(); // not sure that if this is the right way or not, but it pass the compiler
  double energy = output_convert(0);

  return energy;
}


void model::close_session()
{
  session->Close();
}

There are 18 thread problems.

For some reason , i need to use c++ instead of python when using tensorflow library.

I have been stuck in this situation for a while , however i need to get through this . Any solution , idea or opinion will be greatly helpful. Thanks for reading my question.

Comments