小编Pit*_*ght的帖子

张量流存储器MNIST教程

我正在尝试从tensorflow网站完成MNIST教程 我有2gb geforce 760gtx并且每次都耗尽内存.我试图在脚本末尾的代码行中减少批量大小:

for i in range(20000):
batch = mnist.train.next_batch(5)
if i%100 == 0:
    train_accuracy = accuracy.eval(feed_dict={x: batch[0], y_: batch[1], keep_prob: 0.5})
    print("step %d, training accuracy %g"%(i, train_accuracy))
train_step.run(feed_dict={x: batch[0], y_: batch[1], keep_prob: 0.5})
Run Code Online (Sandbox Code Playgroud)

但它总是试图使用相同数量的内存.我是tensorflow的新手,我想问一下,在这个例子中我可以减少内存使用量,或者是否有代码将其推送到CPU?

完整代码:

# Load mnist data
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets('MNIST_data', one_hot=True)

# Start TensorFlow InteractiveSession
import tensorflow as tf
sess = tf.InteractiveSession()

# Build a Softmax Regression Model

# 1. Placeholders
x = tf.placeholder(tf.float32, shape=[None, 784])
y_ = tf.placeholder(tf.float32, shape=[None, …
Run Code Online (Sandbox Code Playgroud)

python memory gpu mnist tensorflow

3
推荐指数
1
解决办法
1202
查看次数

标签 统计

gpu ×1

memory ×1

mnist ×1

python ×1

tensorflow ×1