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

Method call

tensorflow/python/eager/function.py:471–552  ·  view source on GitHub ↗

Calls this function with `args` as inputs. `ConcreteFunction` execution respects device annotations only if the function won't be compiled with xla. Args: ctx: a Context object args: a list of arguments to supply this function with. cancellation_manager: a `Cancellati

(self, ctx, args, cancellation_manager=None)

Source from the content-addressed store, hash-verified

469 return self._stateful_ops
470
471 def call(self, ctx, args, cancellation_manager=None):
472 """Calls this function with `args` as inputs.
473
474 `ConcreteFunction` execution respects device annotations only if the
475 function won't be compiled with xla.
476
477 Args:
478 ctx: a Context object
479 args: a list of arguments to supply this function with.
480 cancellation_manager: a `CancellationManager` object that can be used to
481 cancel function execution.
482
483 Returns:
484 The outputs of the function call.
485
486 Raises:
487 ValueError: if the number of arguments is incorrect.
488 """
489 if len(args) != len(self.signature.input_arg):
490 raise ValueError(
491 "Arguments and signature arguments do not match. "
492 "got: %s, expected: %s " %
493 (len(args), len(list(self.signature.input_arg))))
494
495 function_call_options = ctx.function_call_options
496 if function_call_options.config_proto_serialized is None:
497 config = function_utils.get_disabled_rewriter_config()
498 else:
499 config = function_call_options.config_proto_serialized
500 executor_type = function_call_options.executor_type or ""
501
502 executing_eagerly = ctx.executing_eagerly()
503 if executing_eagerly:
504 with _InterpolateFunctionError(self):
505 if cancellation_manager is None:
506 outputs = execute.execute(
507 str(self.signature.name),
508 num_outputs=self._num_outputs,
509 inputs=args,
510 attrs=("executor_type", executor_type, "config_proto", config),
511 ctx=ctx)
512 else:
513 outputs = execute.execute_with_cancellation(
514 str(self.signature.name),
515 num_outputs=self._num_outputs,
516 inputs=args,
517 attrs=("executor_type", executor_type, "config_proto", config),
518 ctx=ctx,
519 cancellation_manager=cancellation_manager)
520 # Replace empty list with None
521 outputs = outputs or None
522 else:
523 # TODO(akshayka): Either remove this if the FunctionLibraryRuntime
524 # creates `PartitionedCallOp` kernels by default, or remove the previous
525 # branch if a TPU kernel is registered for `PartitionedCall`.
526 with _InterpolateFunctionError(self):
527 with ops.control_dependencies(self._control_captures):
528 # The caller must use record_operation to record this operation in the

Callers

nothing calls this directly

Calls 6

executing_eagerlyMethod · 0.80
stop_recordingMethod · 0.80
executeMethod · 0.45
control_dependenciesMethod · 0.45
set_shapeMethod · 0.45

Tested by

no test coverage detected