ray.rllib.utils.tf_utils.make_tf_callable#

ray.rllib.utils.tf_utils.make_tf_callable(session_or_none: tensorflow.compat.v1.Session | None, dynamic_shape: bool = False) Callable[source]#

Returns a function that can be executed in either graph or eager mode.

The function must take only positional args.

If eager is enabled, this will act as just a function. Otherwise, it will build a function that executes a session run with placeholders internally.

Parameters:
  • session_or_none – tf.Session if in graph mode, else None.

  • dynamic_shape – True if the placeholders should have a dynamic batch dimension. Otherwise they will be fixed shape.

Returns:

A function that can be called in either eager or static-graph mode.