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

Method _call_impl

tensorflow/python/eager/function.py:1083–1121  ·  view source on GitHub ↗

See `__call__` for details.

(self, args, kwargs, cancellation_manager=None)

Source from the content-addressed store, hash-verified

1081 return self._call_impl(args, kwargs)
1082
1083 def _call_impl(self, args, kwargs, cancellation_manager=None):
1084 """See `__call__` for details."""
1085 if self._arg_keywords is None or self._num_positional_args is None:
1086 if self._signature is not None:
1087 if kwargs:
1088 raise NotImplementedError(
1089 "Keyword arguments not supported when calling a "
1090 "wrap_function-decorated function.")
1091 return self._call_flat(args, self.captured_inputs)
1092 raise AssertionError(
1093 "Tried to call a concrete function obtained from an internal API "
1094 "through the public interface. Use get_concrete_function instead.")
1095 if len(args) > self._num_positional_args:
1096 raise TypeError(
1097 ("Expected at most {} positional arguments (and the rest keywords, "
1098 "of {}), got {}. When calling a concrete function, positional "
1099 "arguments may not be bound to Tensors within nested structures."
1100 ).format(self._num_positional_args, self._arg_keywords, args))
1101 args = list(args)
1102 for keyword in self._arg_keywords[len(args):]:
1103 try:
1104 args.append(kwargs.pop(compat.as_str(keyword)))
1105 except KeyError:
1106 specified_keywords = (list(self._arg_keywords[:len(args)])
1107 + list(kwargs.keys()))
1108 raise TypeError(
1109 "Expected argument names {} but got values for {}. Missing: {}."
1110 .format(
1111 list(self._arg_keywords),
1112 specified_keywords,
1113 list(set(self._arg_keywords) - set(specified_keywords))))
1114 if kwargs:
1115 positional_arg_keywords = set(self._arg_keywords[:len(args)])
1116 for unused_key in kwargs:
1117 if unused_key in positional_arg_keywords:
1118 raise TypeError("Got two values for keyword '{}'.".format(unused_key))
1119 raise TypeError("Keyword arguments {} unknown. Expected {}.".format(
1120 list(kwargs.keys()), list(self._arg_keywords)))
1121 return self._call_flat(args, self.captured_inputs, cancellation_manager)
1122
1123 def _filtered_call(self, args, kwargs):
1124 """Executes the function, filtering arguments from the Python function.

Callers 2

__call__Method · 0.95
cancellable_callMethod · 0.95

Calls 5

_call_flatMethod · 0.95
formatMethod · 0.45
appendMethod · 0.45
popMethod · 0.45
keysMethod · 0.45

Tested by

no test coverage detected