junn_predict.common package

Submodules

junn_predict.common.cli module

junn_predict.common.logging module

junn_predict.common.configure_tensorflow module

Helper functionality to configure TensorFlow.

junn_predict.common.configure_tensorflow.configure_tensorflow(seed=None, windows_maximum_gpu_memory=0.75)

Configure TensorFlow.

It is important that this function is called BEFORE first TF import.

  • Reduces TF’s log-level (before) loading.

  • Sets all devices to dynamic memory allocation (growing instead of complete)

  • (On Windows) Sets overall maximum TensorFlow memory to windows_maximum_gpu_memory

  • Removes the tensorflow log adapter from the global logger

  • Sets Keras to use TensorFlow (and sets USE_TENSORFLOW_KERAS to 1, custom environment variable)

Parameters
  • seed – Optional. If set, will be passed to set_seed()

  • windows_maximum_gpu_memory – Set the maximum GPU memory fraction to use (Windows only).

Returns

None

junn_predict.common.configure_tensorflow.get_gpu_memory_usages_megabytes()

Get the current GPU memory usages.

Returns

List of memory usages.

junn_predict.common.configure_tensorflow.set_seed(seed)

Set various RNG seeds, so their behavior becomes reproducible.

Seeds NumPy, Python random, and TensorFlow.

Parameters

seed – Seed value to use.

Returns

junn_predict.common.tensorflow_addons module

Helper functions to dynamically load TensorFlow Addons.

junn_predict.common.tensorflow_addons.try_load_tensorflow_addons()None

Load the TensorFlow Addons module, if present.

Will ignore any compatibility warnings, and loads all tfa activations into the normal namespace.

junn_predict.common.autoconfigure_tensorflow module

junn_predict.common.timed module

Helper module to perform on the fly benchmarking/time keeping.

class junn_predict.common.timed.Timed(name=None)

Bases: object

Context manager to keep track of elapsed time.

precision = 3