我正在使用Tensorflow 1.4 C ++ API从元文件中读取图形,并使用Saver恢复操作从检查点文件加载权重。
从检查点加载权重时,程序在session-> Run()。
期间崩溃来源:
#include <tensorflow/cc/ops/standard_ops.h>
#include <tensorflow/core/framework/tensor.h>
#include <tensorflow/core/public/session.h>
#include <tensorflow/core/protobuf/meta_graph.pb.h>
#define GRAPH_PATH "path-to-graph.meta"
#define CHECKPOINT_PATH "path-to-checkpoint.data-00000-of-00001"
MetaGraphDef graph_def;
Tensor checkpoint_path_tensor(DT_STRING, TensorShape());
auto session = NewSession(SessionOptions());
status = ReadBinaryProto(Env::Default(), GRAPH_PATH, &graph_def);
status = session->Create(graph_def.graph_def());
checkpoint_path_tensor.scalar<string>()() = CHECKPOINT_PATH;
status = session->Run(
{{ graph_def.saver_def().filename_tensor_name(), checkpoint_path_tensor },},
{},
{graph_def.saver_def().restore_op_name()},
nullptr);
跟踪:
#0 0xf1268e14 in std::condition_variable::condition_variable() () from /lib/libstdc++.so.6
#1 0xf555701c in nsync::nsync_mu_semaphore_init(nsync::nsync_semaphore_s_*) () from /lib/libpywrap_tensorflow_internal.so
#2 0xf5557ae4 in nsync::nsync_waiter_new_() () from /lib/libpywrap_tensorflow_internal.so
#3 0xf55558fc in nsync::nsync_cv_wait_with_deadline_generic(nsync::nsync_cv_s_*, void*, void (*)(void*), void (*)(void*), timespec, nsync::nsync_note_s_*) () from /lib/libpywrap_tensorflow_internal.so
#4 0xf5556004 in nsync::nsync_cv_wait_with_deadline(nsync::nsync_cv_s_*, nsync::nsync_mu_s_*, timespec, nsync::nsync_note_s_*) () from /lib/libpywrap_tensorflow_internal.so
#5 0xf5556040 in nsync::nsync_cv_wait(nsync::nsync_cv_s_*, nsync::nsync_mu_s_*) () from /lib/libpywrap_tensorflow_internal.so
#6 0xf2d6ba30 in tensorflow::condition_variable::wait(tensorflow::mutex_lock&) () from /lib/libpywrap_tensorflow_internal.so
#7 0xf2d6c0d4 in tensorflow::Notification::WaitForNotification() () from /lib/libpywrap_tensorflow_internal.so
#8 0xf34f2078 in tensorflow::DirectSession::WaitForNotification(tensorflow::Notification*, long long) () from /lib/libpywrap_tensorflow_internal.so
#9 0xf34f1f14 in tensorflow::DirectSession::WaitForNotification(tensorflow::DirectSession::RunState*, tensorflow::CancellationManager*, long long) () from /lib/libpywrap_tensorflow_internal.so
#10 0xf34ebfc4 in tensorflow::DirectSession::Run(tensorflow::RunOptions const&, std::vector<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, tensorflow::Tensor>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, tensorflow::Tensor> > > const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::vector<tensorflow::Tensor, std::allocator<tensorflow::Tensor> >*, tensorflow::RunMetadata*) () from /lib/libpywrap_tensorflow_internal.so
#11 0xf34eadfc in tensorflow::DirectSession::Run(std::vector<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, tensorflow::Tensor>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, tensorflow::Tensor> > > const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::vector<tensorflow::Tensor, std::allocator<tensorflow::Tensor> >*) () from /lib/libpywrap_tensorflow_internal.so
环境:
我从Tizen(linux)平台的源代码构建了tensorflow 1.4,并链接了共享库libpywrap_tensorflow_internal.so。