Limit GPU memory growth in tensorflow 2.4.x by setting environment variable
本文最后更新于 553 天前,其中的信息可能已经有所发展或是发生改变。

Simplest way(TensorFlow 2.2+)

import tensorflow as tfgpus = tf.config.experimental.list_physical_devices('GPU')for gpu in gpus:  tf.config.experimental.set_memory_growth(gpu, True)

Or set environment variable

set TF_FORCE_GPU_ALLOW_GROWTH to true.

if TensorFlow 2.0 and 2.1

import tensorflow as tftf.config.gpu.set_per_process_memory_growth(True)

Source:

  1. https://www.tensorflow.org/guide/gpu#limiting_gpu_memory_growth
  2. https://stackoverflow.com/questions/34199233/how-to-prevent-tensorflow-from-allocating-the-totality-of-a-gpu-memory/34200194#34200194
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇