雅可比数据集扩充的内存消耗

2024-06-15 08:30:00 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图复制来自https://arxiv.org/abs/1602.02697的结果, 但是使用图片大小224x224x3遵循黑匣子教程https://github.com/tensorflow/cleverhans/blob/master/cleverhans_tutorials/mnist_blackbox.py

但是,我遇到了一个内存消耗错误(粘贴在下面)。在我看来,雅可比数据集扩充可能是源问题: https://github.com/tensorflow/cleverhans/blob/master/cleverhans/utils_tf.py#L657

但是,我不知道怎么检查。你知道吗

我正在8GB的GPU上运行代码。你知道吗

会不会是这种方法无法处理更大的图像?我怎样才能解决这个问题?这个方法有多复杂?你知道吗

...
2019-02-07 18:21:32.984709: I tensorflow/core/common_runtime/bfc_allocator.cc:645] Sum Total of in-use chunks: 7.31GiB
2019-02-07 18:21:32.984715: I tensorflow/core/common_runtime/bfc_allocator.cc:647] Stats:
Limit:                  7860224000
InUse:                  7848987648
MaxInUse:               7848987648
NumAllocs:                10041921
MaxAllocSize:           2424832000

2019-02-07 18:21:32.984831: W tensorflow/core/common_runtime/bfc_allocator.cc:271] ****************************************************************************************************
2019-02-07 18:21:32.984849: W tensorflow/core/framework/op_kernel.cc:1273] OP_REQUIRES failed at transpose_op.cc:199 : Resource exhausted: OOM when allocating tensor with shape[4,256,56,56] and type float on /job:localhost/replica:0/task:0/device:GPU:0 by allocator GPU_0_bfc

Tags: pyhttpscoregithubmastercomgputensorflow
1条回答
网友
1楼 · 发布于 2024-06-15 08:30:00

这很可能是由X_batch的大小在每次迭代p_idxs时加倍这一事实所解释的。如果您将L698-703替换为对CleverHans中提供的batch_eval的调用,那么即使在ImageNet上,您也很可能能够计算出这一点。如果这解决了您的问题,可以在GitHub上作为PR提交给CleverHans。你知道吗

相关问题 更多 >