tf.contrib.layers.recompute_grad( *args, **kwargs )
Decorator that recomputes the function on the backwards pass.
fn: a function that takes Tensors (all as positional arguments) and returns a tuple of Tensors.
Truewill use a dummy data dependency to force the recompute to happen. If
Falsewill use a control dependency. By default will be
Trueif in an XLA context and
Falseotherwise. XLA ignores control dependencies and so this data dependency is necessary.
Truewill use control dependencies to ensure that all gradients are produced before any are consumed by downstream ops. If
True, will use a data dependency instead of a control dependency.
A wrapped fn that is identical to fn when called, but its activations will be discarded and recomputed on the backwards pass (i.e. on a call to tf.gradients).
© 2018 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.