Module with TensorFlow util functions.



Create TensorFlow activation function with the given name.

List of available activation functions is available in TensorFlow docs.

Parameters:activation_name (str) – activation function name
Return type:Callable[[Tensor], Tensor]
Returns:callable activation function

Create TF optimizer according to the given config.

When module entry is not present in the optimizer_config, the function attempts to find it under the TF_OPTIMIZER_MODULE.

A tf variable named learning_rate is created during the process. One must handle Graphs and Sessions carefully when using this function.

Parameters:optimizer_config (Dict[str, Any]) – dict with at least class and learning_rate entries.


  • Profiler: Profiles tensorflow graphs and saves the profiles.
class emloop_tensorflow.utils.Profiler(log_dir, keep_profiles, session)[source]

Bases: object

Profiles tensorflow graphs and saves the profiles.

Inheritance diagram of Profiler

__init__(log_dir, keep_profiles, session)[source]
  • log_dir (str) – directory where profiles will be saved
  • keep_profiles (int) – how many profiles are saved
run(fetches, feed_dict)[source]

Evaluates the tensorflow graph with profiling, saves profile and returns outputs.

  • session – tensorflow session
  • fetches (Dict[~KT, ~VT]) – names of output tensors
  • feed_dict (Dict[~KT, ~VT]) – input tensors