MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / _should_cache

Function _should_cache

tensorflow/python/ops/rnn.py:133–142  ·  view source on GitHub ↗

Returns True if a default caching device should be set, otherwise False.

()

Source from the content-addressed store, hash-verified

131
132
133def _should_cache():
134 """Returns True if a default caching device should be set, otherwise False."""
135 if context.executing_eagerly():
136 return False
137 # Don't set a caching device when running in a loop, since it is possible that
138 # train steps could be wrapped in a tf.while_loop. In that scenario caching
139 # prevents forward computations in loop iterations from re-reading the
140 # updated weights.
141 ctxt = ops.get_default_graph()._get_control_flow_context() # pylint: disable=protected-access
142 return control_flow_util.GetContainingWhileContext(ctxt) is None
143
144
145def _is_keras_rnn_cell(rnn_cell):

Callers 4

dynamic_rnnFunction · 0.90
dynamic_rnnFunction · 0.85
raw_rnnFunction · 0.85
static_rnnFunction · 0.85

Calls 2

executing_eagerlyMethod · 0.80

Tested by

no test coverage detected