ray.rllib.utils.framework.try_import_tf#
- ray.rllib.utils.framework.try_import_tf(error: bool = False)[source]#
Tries importing tf and returns the module (or None).
- Parameters:
error – Whether to raise an error if tf cannot be imported.
- Returns:
Tuple containing 1) tf1.x module (either from tf2.x.compat.v1 OR as tf1.x). 2) tf module (resulting from
import tensorflow
). Either tf1.x or 2.x. 3) The actually installed tf version as int: 1 or 2.- Raises:
ImportError – If error=True and tf is not installed.