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

Method __call__

tensorflow/python/framework/function.py:563–580  ·  view source on GitHub ↗
(self, *args, **kwargs)

Source from the content-addressed store, hash-verified

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
583class _OverloadedFunction(object):

Callers

nothing calls this directly

Calls 3

add_to_graphMethod · 0.95
_callFunction · 0.85
set_shapeMethod · 0.45

Tested by

no test coverage detected