(self, op)
| 852 | return op.outputs[tensor.value_index] |
| 853 | |
| 854 | def _add_op_and_parents(self, op): |
| 855 | # pylint: disable=protected-access |
| 856 | op_def = graph_to_function_def._get_op_def(op) |
| 857 | if op._is_stateful and op not in self._whitelisted_stateful_ops: |
| 858 | raise ValueError("Cannot capture a stateful node (name:%s, type:%s) " |
| 859 | "by value." % (op.name, op.type)) |
| 860 | elif op.type in ("Placeholder", "PlaceholderV2"): |
| 861 | raise ValueError("Cannot capture a placeholder (name:%s, type:%s) " |
| 862 | "by value." % (op.name, op.type)) |
| 863 | # pylint: enable=protected-access |
| 864 | |
| 865 | captured_inputs = [self._add_tensor_and_parents(x) for x in op.inputs] |
| 866 | |
| 867 | captured_op = self.create_op( |
| 868 | op.type, |
| 869 | captured_inputs, [o.dtype for o in op.outputs], |
| 870 | name=op.name, |
| 871 | attrs=op.node_def.attr, |
| 872 | op_def=op_def) |
| 873 | |
| 874 | for t, captured_t in zip(op.outputs, captured_op.outputs): |
| 875 | self._captured[t] = captured_t |
| 876 | |
| 877 | return captured_op |
| 878 | |
| 879 | |
| 880 | def func_graph_from_py_func(func, |
no test coverage detected