问答详情
源自:-

运行卷积的时候出错...找不到问题出在哪里...

这是控制台包的错误

Caused by op 'convolutional/Conv2D', defined at:

  File "D:/Python/Mnist_testdemo2/mnist/convolutional.py", line 12, in <module>

    y, variables = model.convolutional(x, keep_prob)

  File "D:\Python\Mnist_testdemo2\mnist\model.py", line 32, in convolutional

    h_conv1 = tf.nn.relu(conv2d(x_image, W_conv1) + b_conv1)

  File "D:\Python\Mnist_testdemo2\mnist\model.py", line 15, in conv2d

    return tf.nn.conv2d(x, W, strides=[1, 1, 1, 1], padding='SAME')

  File "D:\Programme\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\ops\gen_nn_ops.py", line 1112, in conv2d

    data_format=data_format, dilations=dilations, name=name)

  File "D:\Programme\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 788, in _apply_op_helper

    op_def=op_def)

  File "D:\Programme\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\util\deprecation.py", line 507, in new_func

    return func(*args, **kwargs)

  File "D:\Programme\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\framework\ops.py", line 3300, in create_op

    op_def=op_def)

  File "D:\Programme\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\framework\ops.py", line 1801, in __init__

    self._traceback = tf_stack.extract_stack()


ResourceExhaustedError (see above for traceback): OOM when allocating tensor with shape[10000,28,28,32] and type float on /job:localhost/replica:0/task:0/device:CPU:0 by allocator cpu

[[node convolutional/Conv2D (defined at D:\Python\Mnist_testdemo2\mnist\model.py:15) ]]

Hint: If you want to see a list of allocated tensors when OOM happens, add report_tensor_allocations_upon_oom to RunOptions for current allocation info.


Process finished with exit code 1



代码部分:

1:

File "D:/Python/Mnist_testdemo2/mnist/convolutional.py", line 12, in <module>

    y, variables = model.convolutional(x, keep_prob)

对应代码:

y, variables = model.convolutional(x, keep_prob)

2:
File "D:\Python\Mnist_testdemo2\mnist\model.py", line 32, in convolutional    h_conv1 = tf.nn.relu(conv2d(x_image, W_conv1) + b_conv1)

对应代码:

h_conv1 = tf.nn.relu(conv2d(x_image, W_conv1) + b_conv1)

3:

  File "D:\Python\Mnist_testdemo2\mnist\model.py", line 15, in conv2d

    return tf.nn.conv2d(x, W, strides=[1, 1, 1, 1], padding='SAME')

对应代码:

return tf.nn.conv2d(x, W, strides=[1, 1, 1, 1], padding='SAME')

希望有人能帮我解答一下...谢谢你们

提问者:Raeky 2019-02-26 18:24

个回答

  • shen222ying2224267996
    2019-05-28 18:36:29

    如何添加虚拟内存?

  • Raeky
    2019-02-26 22:31:28

    加了个虚拟内存就解决了

  • Raeky
    2019-02-26 18:50:29

    补充一下,最下面显示memoryerror