【发布时间】:2018-03-29 14:10:34
【问题描述】:
我正在加载一个 Trianed TensorFlow 模型并运行它。当我尝试设置 gpu 编号时,出现错误。
F tensorflow/core/common_runtime/device_factory.cc:77] 重复 为具有相同优先级的 GPU 类型注册设备工厂 210
我使用的代码是这样的:
tensorflow::GraphDef graph_def;
tensorflow::Status graphLoadedStatus = ReadBinaryProto(tensorflow::Env::Default(),model_path, &graph_def);
if (!graphLoadedStatus.ok()) {
std::cerr <<"Model path : " << graphLoadedStatus.ToString() << std::endl;
return graphLoadedStatus;
}
// set device to be on gpu
tensorflow::graph::SetDefaultDevice("/gpu:3", &graph_def);
谷歌一下,除了tensoeflow的源代码没有结果:https://github.com/tensorflow/tensorflow/blob/master/tensorflow/core/common_runtime/device_factory.cc
有人遇到过吗?或者tf的贡献者能给我一些线索吗?
好像是优先级的问题,所以我尝试用root运行,但是没有用。
顺便说一句,我正在使用 C++。如果我使用python,我可以正确设置gpu编号。
【问题讨论】:
标签: c++ tensorflow