小编ana*_*not的帖子

Tensorflow 耗尽 GPU 内存:分配器 (GPU_0_bfc) 尝试分配内存不足

我对 Tensorflow 相当陌生,并且在使用数据集时遇到了问题。我在Windows 10上工作,Tensorflow版本是2.6.0,与CUDA一起使用。我有 2 个 numpy 数组,分别是 X_train 和 X_test (已拆分)。火车是5Gb,测试是1.5Gb。形状是:

X_train: (259018, 30, 30, 3), <class 'numpy.ndarray'>

Y_train: (259018, 1), <class 'numpy.ndarray'>

我使用以下代码创建数据集:

dataset_train = tf.data.Dataset.from_tensor_slices((X_train , Y_train)).batch(BATCH_SIZE)
Run Code Online (Sandbox Code Playgroud)

BATCH_SIZE = 32。

但我无法创建数据集,出现以下错误:

2021-09-02 15:26:35.429930: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2021-09-02 15:26:35.772235: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1510] Created device …
Run Code Online (Sandbox Code Playgroud)

python tensorflow tensorflow-datasets tensorflow2.0

5
推荐指数
1
解决办法
1万
查看次数