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

Function get_dependent_variables

tensorflow/python/ops/custom_gradient.py:196–210  ·  view source on GitHub ↗

Finds variables involved in the subgraph b/w input_ops and output_ops.

(input_ops, output_ops)

Source from the content-addressed store, hash-verified

194
195
196def get_dependent_variables(input_ops, output_ops):
197 """Finds variables involved in the subgraph b/w input_ops and output_ops."""
198
199 # avoids the edge-case when input_ops == output_ops.
200 output_ops = nest.map_structure(gen_array_ops.identity, output_ops)
201 inbetween_ops = op_selector.get_backward_walk_ops(
202 seed_ops=nest.flatten(output_ops),
203 stop_at_ts=nest.flatten(input_ops),
204 inclusive=False,
205 only_differentiable=True)
206 var_ops = (op for op in inbetween_ops if op.type in VAR_OP_TYPES)
207 var_names = (op.name for op in var_ops)
208 tf_vars = (get_variable_by_name(var_name) for var_name in var_names)
209 tf_vars = [v for v in tf_vars if v is not None]
210 return tf_vars
211
212
213def _graph_mode_decorator(f, *args, **kwargs):

Callers 1

_graph_mode_decoratorFunction · 0.85

Calls 2

get_variable_by_nameFunction · 0.70
flattenMethod · 0.45

Tested by

no test coverage detected