garage.tf.optimizers.utils module

Utilities for TensorFlow optimizers.

class LazyDict(**kwargs)[source]

Bases: object

An immutable, lazily-evaluated dict.

get(key, default=None)[source]

Implement dict.get.

set(key, value)[source]

Implement dict.set.

sliced_fun(f, n_slices)[source]

Divide function f’s inputs into several slices.

Evaluate f on those slices, and then average the result. It is useful when memory is not enough to process all data at once. Assume: 1. each of f’s inputs is iterable and composed of multiple “samples” 2. outputs can be averaged over “samples”