(self, *args, **kwargs)
| 561 | self._grad_func.add_to_graph(g) |
| 562 | |
| 563 | def __call__(self, *args, **kwargs): |
| 564 | self.add_to_graph(ops.get_default_graph()) |
| 565 | args = [ops.convert_to_tensor(_) for _ in args] + self._extra_inputs |
| 566 | ret, op = _call(self._signature, *args, **kwargs) |
| 567 | |
| 568 | # Set a hidden attr in 'op' so that gradients_impl can refer back |
| 569 | # to this _DefinedFunction instance to access python_grad_func. |
| 570 | assert isinstance(op, ops.Operation) |
| 571 | setattr(op, "__defun", self) |
| 572 | |
| 573 | if self._shape_func is not None: |
| 574 | shapes = self._shape_func(op) |
| 575 | if len(shapes) != len(op.outputs): |
| 576 | raise ValueError("shape_func produced %d shapes for %d outputs" % |
| 577 | (len(shapes), len(op.outputs))) |
| 578 | for (t, shape) in zip(op.outputs, shapes): |
| 579 | t.set_shape(shape) |
| 580 | return ret |
| 581 | |
| 582 | |
| 583 | class _OverloadedFunction(object): |
nothing calls this directly
no test coverage detected