Tensorflow运行速度比Benchmarks慢?

时间:2017-01-01 18:25:41

标签: python performance tensorflow neural-network

所以我只是尝试一般的AlexNet。我将ImageNet数据处理为https://github.com/tensorflow/models/tree/master/inception,我正在加载:

G = tf.Graph()
sess = tf.InteractiveSession(graph=G,
                                config=tf.ConfigProto(allow_soft_placement=True))


train_dataset = ImagenetData('train')

train_images, train_labels = image_processing.distorted_inputs(train_dataset)

if mode == 'local':
    label_batch = tf.one_hot(train_labels,k)
elif mode =='sherlock':
    label_batch = tf.cast(tf.one_hot(train_labels,k,1,0),tf.float32)



AlexNet = ConvNet(G,'AlexNet',session=sess,X =image_batch,y = label_batch,k=k,H=H,W=W,D=D,mode='sherlock')
AlexNet.session.run(tf.Print([1], [1], str(LR)))
AlexNet.session.run(tf.initialize_all_variables())


with tf.device('/gpu:0'):

    [..Build AlexNet here...]

    AlexNet.finalizeBuild()



coord = tf.train.Coordinator()
AlexNet.session.run(tf.Print([1], [1], 'coordinator made'))
threads = tf.train.start_queue_runners(sess=AlexNet.session,coord=coord)


val_accs = []
losses = [] 

for itt in range(nitt):

    AlexNet.session.run(tf.Print([1], [1], str(itt)))


    AlexNet.session.run(train_step)

每批运行大约需要15秒....当我查看类似GPU的基准测试(https://github.com/soumith/convnet-benchmarks/blob/master/README.md)时,我发现每批只需要81毫秒。我在这里做错了什么?

0 个答案:

没有答案