Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如何控制显存使用 #4

Open
johnsonkee opened this issue May 8, 2019 · 2 comments
Open

如何控制显存使用 #4

johnsonkee opened this issue May 8, 2019 · 2 comments

Comments

@johnsonkee
Copy link

tf1.x里可以使用
config = tf.ConfigProto()
config.gpu_options.allow_growth = True
session = tf.Session(config=config)
来控制显存的使用

但是在tf2.0里,session已经被去除,请问如何控制显存的使用呢?

谢谢!

@czy36mengfei
Copy link
Owner

按需使用显存:
tf.config.gpu.set_per_process_memory_growth(enabled=True)

控制显存占比:
tf.config.gpu.set_per_process_memory_fraction(0.4)

@johnsonkee
Copy link
Author

谢谢!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants