[这是我的代码,我想将GPU用于我的代码。当前它正在CPU上运行。
elf.graph = tf.Graph()
with self.graph.as_default():
self.face_graph = tf.GraphDef()
fid=tf.gfile.GFile(self.facenet_model, 'rb')
serialized_graph = fid.read()
self.face_graph.ParseFromString(serialized_graph)
tf.import_graph_def(self.face_graph, name='')
self.facenet_sess = tf.Session(graph=self.graph)
self.images_placeholder = self.graph.get_tensor_by_name("input:0")
self.embeddings = self.graph.get_tensor_by_name("embeddings:0")
包装在里面
with tf.device('/GPU:0'):
....