张量流与节俭无关

时间:2017-02-21 04:15:42

标签: tensorflow-serving

我写了一个简单的张量流代码,如下:

class Classify():
    def __init__(self):
        session_conf = tf.ConfigProto(log_device_placement=True,device_count = {'GPU': 0}) 
        self.sess = sess = tf.InteractiveSession(config=session_conf)
        x = tf.Variable([1.0, 2.0])
        a = tf.constant([3.0, 3.0])
        with sess.as_default():
        # Initialize 'x' using the run() method of its initializer op.
            x.initializer.run()

        # Add an op to subtract 'a' from 'x'.  Run it and print the result
            self.sub = tf.add(x, a)

    def clf(self, word):
        with self.sess.as_default():
            print 'xxxxxxxxxxxxxxxxxxx'
            return self.sub.eval()

当我建立一个obejct并调用obj.clf时,它运行良好。 但是当我使用thrift时,我在服务器端创建obj,并使用thrift API调用以使服务器运行obj.clf。它首先返回错误

E tensorflow/stream_executor/cuda/cuda_driver.cc:1296] failed to enqueue          
async memcpy from host to device: CUDA_ERROR_NOT_INITIALIZED; GPU dst:
0x2305ba0700; host src: 0x2048a0000; size: 8=0x8

当我重现这个错误的一些内容时,他们在我调用thrift客户端后总是阻塞死亡。

任何人都能与节俭和张量流很好地合作吗?

0 个答案:

没有答案