(self, inputs)
| 2597 | return node_def |
| 2598 | |
| 2599 | def _make_op(self, inputs): |
| 2600 | inputs = nest.flatten(inputs) |
| 2601 | graph = inputs[0].graph |
| 2602 | node_def = self._make_node_def(graph) |
| 2603 | with graph.as_default(): |
| 2604 | for index, constant in self.constants.items(): |
| 2605 | # Recreate constant in graph to add distribution context. |
| 2606 | value = tensor_util.constant_value(constant) |
| 2607 | if value is not None: |
| 2608 | constant = constant_op.constant(value, name=node_def.input[index]) |
| 2609 | inputs.insert(index, constant) |
| 2610 | # Check for case where first input should be a list of Tensors. |
| 2611 | if 'N' in node_def.attr: |
| 2612 | num_tensors = node_def.attr['N'].i |
| 2613 | inputs = [inputs[:num_tensors]] + inputs[num_tensors:] |
| 2614 | c_op = ops._create_c_op(graph, node_def, inputs, control_inputs=[]) |
| 2615 | op = graph._create_op_from_tf_operation(c_op) |
| 2616 | op._control_flow_post_processing() |
| 2617 | |
| 2618 | # Record the gradient because custom-made ops don't go through the |
| 2619 | # code-gen'd eager call path |
| 2620 | op_type = compat.as_str(op.op_def.name) |
| 2621 | attr_names = [compat.as_str(attr.name) for attr in op.op_def.attr] |
| 2622 | attrs = [] |
| 2623 | for attr_name in attr_names: |
| 2624 | attrs.append(attr_name) |
| 2625 | attrs.append(op.get_attr(attr_name)) |
| 2626 | attrs = tuple(attrs) |
| 2627 | execute.record_gradient(op_type, op.inputs, attrs, op.outputs, op.name) |
| 2628 | |
| 2629 | if len(op.outputs) == 1: |
| 2630 | return op.outputs[0] |
| 2631 | return op.outputs |
| 2632 | |
| 2633 | @function.defun |
| 2634 | def _defun_call(self, inputs): |
no test coverage detected