Type tf.experimental
Namespace tensorflow
Methods
- function_executor_type
- function_executor_type_dyn
- output_all_intermediates
- output_all_intermediates_dyn
Properties
Public static methods
IContextManager<T> function_executor_type(string executor_type)
Context manager for setting the executor of eager defined functions. Eager defined functions are functions decorated by tf.contrib.eager.defun.
Parameters
-
string
executor_type - a string for the name of the executor to be used to execute functions defined by tf.contrib.eager.defun.
object function_executor_type_dyn(object executor_type)
Context manager for setting the executor of eager defined functions. Eager defined functions are functions decorated by tf.contrib.eager.defun.
Parameters
-
object
executor_type - a string for the name of the executor to be used to execute functions defined by tf.contrib.eager.defun.
void output_all_intermediates(Nullable<bool> state)
Whether to output all intermediates from functional control flow ops. The "default" behavior to is to output all intermediates when using v2 control
flow inside Keras models in graph mode (possibly inside Estimators). This is
needed to support taking gradients of v2 control flow. In graph mode, Keras
can sometimes freeze the forward graph before the gradient computation which
does not work for v2 control flow since it requires updating the forward ops
to output the needed intermediates. We work around this by proactively
outputting the needed intermediates when building the forward pass itself.
Ideally any such extra tensors should be pruned out at runtime. However, if
for any reason this doesn't work for you or if you have an infernce-only model
you can turn this behavior off using
`tf.compat.v1.experimental.output_all_intermediates(False)`. If with the default behavior you are still seeing errors of the form
"Connecting to invalid output X of source node Y which has Z outputs" try
setting `tf.compat.v1.experimental.output_all_intermediates(True)` and
please file an issue at https://github.com/tensorflow/tensorflow/issues.
Parameters
-
Nullable<bool>
state - True, False or None. None restores the default behavior.
object output_all_intermediates_dyn(object state)
Whether to output all intermediates from functional control flow ops. The "default" behavior to is to output all intermediates when using v2 control
flow inside Keras models in graph mode (possibly inside Estimators). This is
needed to support taking gradients of v2 control flow. In graph mode, Keras
can sometimes freeze the forward graph before the gradient computation which
does not work for v2 control flow since it requires updating the forward ops
to output the needed intermediates. We work around this by proactively
outputting the needed intermediates when building the forward pass itself.
Ideally any such extra tensors should be pruned out at runtime. However, if
for any reason this doesn't work for you or if you have an infernce-only model
you can turn this behavior off using
`tf.compat.v1.experimental.output_all_intermediates(False)`. If with the default behavior you are still seeing errors of the form
"Connecting to invalid output X of source node Y which has Z outputs" try
setting `tf.compat.v1.experimental.output_all_intermediates(True)` and
please file an issue at https://github.com/tensorflow/tensorflow/issues.
Parameters
-
object
state - True, False or None. None restores the default behavior.