Finds variables involved in the subgraph b/w input_ops and output_ops.
(input_ops, output_ops)
| 194 | |
| 195 | |
| 196 | def 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 | |
| 213 | def _graph_mode_decorator(f, *args, **kwargs): |
no test coverage detected