This worked for me on TensorFlow 2.1.0 (per: https://www.tensorflow.org/api_docs/python/tf/config/experimental/set_memory_growth)
import tensorflow as tf physical_devices = tf.config.list_physical_devices('GPU') for device in physical_devices: tf.config.experimental.set_memory_growth(device, True)
Related Posts:
- ImportError: No module named ‘tensorflow.python’
- Can I run Keras model on gpu?
- What is the difference between sparse_categorical_crossentropy and categorical_crossentropy?
- LSTM Keras input shape confusion
- How to fix “AttributeError: module ‘tensorflow’ has no attribute ‘get_default_graph'”?
- Tensorflow 2.0 – AttributeError: module ‘tensorflow’ has no attribute ‘Session’
- ImportError: No module named tensorflow
- How to find which version of TensorFlow is installed in my system?
- How to fix ‘Object arrays cannot be loaded when allow_pickle=False’ for imdb.load_data() function?
- Could not find a version that satisfies the requirement tensorflow
- Could not find a version that satisfies the requirement tensorflow
- Convert a tensor to numpy array in Tensorflow?
- Convert a tensor to numpy array in Tensorflow?
- Convert a tensor to numpy array in Tensorflow?
- Tensorflow: why ‘pip uninstall tensorflow’ cannot find tensorflow
- Installing tensorflow with anaconda in windows
- Cannot uninstall Tensorflow
- Keras, how do I predict after I trained a model?
- error: Failed to load the native TensorFlow runtime
- How to tell if tensorflow is using gpu acceleration from inside python shell?
- pip3: command not found
- ImportError: libcuda.so.1: cannot open shared object file
- Where do I call the BatchNormalization function in Keras?
- Import error when trying to import tensorflow with gpu
- What is the difference between np.mean and tf.reduce_mean?
- Failed to load the native TensorFlow runtime – TensorFlow 2.1
- Issues using Keras np_utils.to_categorical
- No Module Named ‘_pywrap_tensorflow_internal’
- AttributeError: ‘Tensor’ object has no attribute ‘_keras_history’
- Get Confusion Matrix From a Keras Multiclass Model
- What’s the difference between scikit-learn and tensorflow? Is it possible to use them together?
- tar: Unrecognized archive format error when trying to unpack flower_photos.tgz, TF tutorials on OSX
- can’t open tensorboard 0.0.0.0:6006 or localhost:6006
- ImportError: cannot import name np_utils
- getting ValueError : “Can only tuple-index with a MultiIndex “
- NaN loss when training regression network
- No module named ‘tqdm’
- What is the difference between ‘SAME’ and ‘VALID’ padding in tf.nn.max_pool of tensorflow?
- RuntimeError: module compiled against API version 0xc but this version of numpy is 0xb
- Install pip for python 3.5
- How to change python version in Anaconda?
- AttributeError: ‘module’ object has no attribute ‘main’ for tf.app.run()
- How to downgrade tensorflow, multiple versions possible?
- How to convert list to string [duplicate]
- How to uninstall a package installed with pip install –user
- numpy max vs amax vs maximum
- Asking the user for input until they give a valid response
- Print a list in reverse order with range()?
- Configuring so that pip install can work from github
- Proper way to declare custom exceptions in modern Python?
- TypeError: ‘float’ object not iterable
- write() versus writelines() and concatenated strings
- Why is it string.join(list) instead of list.join(string)?
- Remove all special characters, punctuation and spaces from string
- AttributeError: ” object has no attribute ”
- Plot pie chart and table of pandas dataframe
- ModuleNotFoundError: No module named ‘matplotlib’
- “inconsistent use of tabs and spaces in indentation”
- Pandas ‘count(distinct)’ equivalent
- How can I flush the output of the print function?
- Python calling method in class
- How do I find the distance between two points?
- How do I calculate percentiles with python/numpy?
- How do I remove a substring from the end of a string?
- Selecting with complex criteria from pandas.DataFrame
- How can I download Anaconda for python 3.6
- django:django.core.exceptions.AppRegistryNotReady: Apps aren’t loaded yet
- Replace and overwrite instead of appending
- How to get JSON from webpage into Python script
- Moving average or running mean
- How to select a drop-down menu value with Selenium using Python?
- ValueError: x and y must be the same size
- TypeError: ‘int’ object does not support item assignment
- Loading a file with more than one line of JSON into Pandas
- SystemError: new style getargs format but argument is not a tuple?
- Python Subprocess: Too Many Open Files
- urllib2.HTTPError: HTTP Error 403: Forbidden
- .write not working in Python
- Install Plotly in Anaconda
- ValueError: zero length field name in format in Python2.6.6
- Accessing a class’ member variables in Python?
- Declaring a multi dimensional dictionary in python
- How do I compute derivative using Numpy?
- No module named utils error on compiling py file
- Convert Pandas Column to DateTime
- ImportError: cannot import name NUMPY_MKL
- Meaning of list[-1] in Python
- Tkinter error: Couldn’t recognize data in image file
- How to install Openpyxl with pip
- getting ZeroDivisionError: integer division or modulo by zero
- Iterating through list of list in Python
- Installing scipy for python 2.7
- Installing MySQL-python causes command ‘clang’ failed with exit status 1 on Mac OS 10.13.15
- What is the most efficient way to store a list in the Django models?
- Convert list of dictionaries to a pandas DataFrame
- How to read html from a url in python 3
- Set variable in jinja
- Python how to write to a binary file?
- How to download a file via FTP with Python ftplib
- How do I restart a program based on user input?