此处代码在我电脑里面运行出现如下问题

来源:4-9 如何通过TF对已经打包过的数据进行解析

慕尼黑0519427

2020-02-17

安装的tensorflow-gpu版本是1.12.0 其余都与老师一致 但是就是运行不出来

/home/cyz/anaconda3/envs/py_35/bin/python /home/cyz/PycharmProjects/code/data-deal.py
WARNING:tensorflow:From /home/cyz/PycharmProjects/code/data-deal.py:6: string_input_producer (from tensorflow.python.training.input) is deprecated and will be removed in a future version.
Instructions for updating:
Queue-based input pipelines have been replaced by tf.data. Use tf.data.Dataset.from_tensor_slices(string_tensor).shuffle(tf.shape(input_tensor, out_type=tf.int64)[0]).repeat(num_epochs). If shuffle=False, omit the .shuffle(...).
WARNING:tensorflow:From /home/cyz/anaconda3/envs/py_35/lib/python3.5/site-packages/tensorflow/python/training/input.py:276: input_producer (from tensorflow.python.training.input) is deprecated and will be removed in a future version.
Instructions for updating:
Queue-based input pipelines have been replaced by tf.data. Use tf.data.Dataset.from_tensor_slices(input_tensor).shuffle(tf.shape(input_tensor, out_type=tf.int64)[0]).repeat(num_epochs). If shuffle=False, omit the .shuffle(...).
WARNING:tensorflow:From /home/cyz/anaconda3/envs/py_35/lib/python3.5/site-packages/tensorflow/python/training/input.py:188: limit_epochs (from tensorflow.python.training.input) is deprecated and will be removed in a future version.
Instructions for updating:
Queue-based input pipelines have been replaced by tf.data. Use tf.data.Dataset.from_tensors(tensor).repeat(num_epochs).
WARNING:tensorflow:From /home/cyz/anaconda3/envs/py_35/lib/python3.5/site-packages/tensorflow/python/training/input.py:197: QueueRunner.init (from tensorflow.python.training.queue_runner_impl) is deprecated and will be removed in a future version.
Instructions for updating:
To construct input pipelines, use the tf.data module.
WARNING:tensorflow:From /home/cyz/anaconda3/envs/py_35/lib/python3.5/site-packages/tensorflow/python/training/input.py:197: add_queue_runner (from tensorflow.python.training.queue_runner_impl) is deprecated and will be removed in a future version.
Instructions for updating:
To construct input pipelines, use the tf.data module.
WARNING:tensorflow:From /home/cyz/PycharmProjects/code/data-deal.py:7: TFRecordReader.init (from tensorflow.python.ops.io_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Queue-based input pipelines have been replaced by tf.data. Use tf.data.TFRecordDataset.
WARNING:tensorflow:From /home/cyz/PycharmProjects/code/data-deal.py:17: shuffle_batch (from tensorflow.python.training.input) is deprecated and will be removed in a future version.
Instructions for updating:
Queue-based input pipelines have been replaced by tf.data. Use tf.data.Dataset.shuffle(min_after_dequeue).batch(batch_size).
2020-02-17 19:10:21.771700: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2020-02-17 19:10:21.811886: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:964] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-02-17 19:10:21.812184: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1432] Found device 0 with properties:
name: GeForce 940MX major: 5 minor: 0 memoryClockRate(GHz): 1.2415
pciBusID: 0000:01:00.0
totalMemory: 1.96GiB freeMemory: 231.44MiB
2020-02-17 19:10:21.812203: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1511] Adding visible gpu devices: 0
2020-02-17 19:10:22.616483: I tensorflow/core/common_runtime/gpu/gpu_device.cc:982] Device interconnect StreamExecutor with strength 1 edge matrix:
2020-02-17 19:10:22.616512: I tensorflow/core/common_runtime/gpu/gpu_device.cc:988] 0
2020-02-17 19:10:22.616521: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1001] 0: N
2020-02-17 19:10:22.616636: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1115] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 169 MB memory) -> physical GPU (device: 0, name: GeForce 940MX, pci bus id: 0000:01:00.0, compute capability: 5.0)
2020-02-17 19:10:22.628205: E tensorflow/stream_executor/cuda/cuda_driver.cc:806] failed to allocate 169.19M (177405952 bytes) from device: CUDA_ERROR_OUT_OF_MEMORY: out of memory
WARNING:tensorflow:From /home/cyz/PycharmProjects/code/data-deal.py:30: start_queue_runners (from tensorflow.python.training.queue_runner_impl) is deprecated and will be removed in a future version.
Instructions for updating:
To construct input pipelines, use the tf.data module.

写回答

1回答

会写代码的好厨师

2020-02-24

CUDA_ERROR_OUT_OF_MEMORY: out of memory  显存不够,可以设置按需分配显存。

gpu_options = tf.GPUOptions(allow_growth=True)

sess = tf.Session(config=tf.ConfigProto(gpu_options=gpu_options))

0
0

Python3+TensorFlow打造人脸识别智能小程序

理论与实战项目双管齐下,让AI技术真正落地应用,适合毕设展示。

1086 学习 · 538 问题

查看课程