【发布时间】:2017-12-12 13:51:49
【问题描述】:
我正在尝试为使用 Tensorflow 的 convNN 运行超参数优化脚本。 您可能知道,GPU-Memory 的 TF 处理并不那么花哨(不要认为它会永远如此,多亏了 TPU)。所以我的问题是我如何知道选择过滤器尺寸和批量大小,以便 GPU 内存不会耗尽。 这是我正在考虑的等式:
image_shape =128x128x3(3 color channel)
batchSitze = 20 ( is the smallest possible batchsize, since I got 20 klasses)
filter_shape= fw_fh_fd[filter_width=4, filter_height=4, filter_depth=32]
据了解,使用tf.conv2d函数将需要以下内存量:
image_width * image_height *numerofchannel*batchSize*filter_height*filter_width*filter_depth*32bit
因为我们为每个像素输入tf.float32。
在给定的示例中,所需的内存将是:
128x128x3x20x4x4x32x32 =16106127360 (bits),这都是最多 16GB 的内存。
我的公式不是正确的,所以我希望得到验证或更正我所缺少的内容。
【问题讨论】:
-
Andrew Karpathy 的博客cs231n.github.io/convolutional-networks 解释了如何计算卷积网络所需的内存。向下滚动到博客的最后一部分。欢呼
标签: tensorflow out-of-memory gpu conv-neural-network