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

Method __call__

tensorflow/python/ops/template.py:657–681  ·  view source on GitHub ↗
(self, *args, **kwargs)

Source from the content-addressed store, hash-verified

655 raise
656
657 def __call__(self, *args, **kwargs):
658 # In both branches below, the template store is installed as default after
659 # the variable scope is opened in order to ensure that templates nested at
660 # the same level correctly uniquify lower variable scope names.
661 if self._variable_scope:
662 # Create a cache for the variable scope context manager the first time
663 # around so that we don't have to keep recreating it.
664 if not self._variable_scope_context_manager:
665 self._variable_scope_context_manager = variable_scope.variable_scope(
666 self._variable_scope, reuse=variable_scope.AUTO_REUSE)
667 with self._variable_scope_context_manager:
668 with self._template_store.as_default():
669 return self._call_func(args, kwargs)
670 else:
671 # The scope was not created at construction time, so create it here.
672 # Subsequent calls should reuse variables.
673 with variable_scope.variable_scope(
674 self._unique_name, self._name,
675 custom_getter=self._custom_getter) as vs:
676 self._variable_scope = vs
677 # Because the scope was not created at construction time, the template
678 # store's variable scope name is unset; set it here.
679 self._template_store.set_variable_scope_name(vs.name)
680 with self._template_store.as_default():
681 return self._call_func(args, kwargs)
682
683 @property
684 def variables(self):

Callers

nothing calls this directly

Calls 4

_call_funcMethod · 0.95
variable_scopeMethod · 0.80
as_defaultMethod · 0.45

Tested by

no test coverage detected