tf.types.experimental.AtomicFunction
Stay organized with collections
Save and categorize content based on your preferences.
Base class for graph functions.
Inherits From: Callable
An AtomicFunction
encapsulates a single graph function definition.
AtomicFunction
can be called directly only if no captures are needed
according to the FunctionType
. If captures are present, please use
call_with_captures
instead.
AtomicFunction
does not support gradients. Please use the parent
ConcreteFunction
if you need gradient support.
Attributes |
function_type
|
Returns a FunctionType describing this callable.
|
Methods
call_with_captures
View source
call_with_captures(
args, kwargs, captures
)
Calls this AtomicFunction with captures as defined by its FunctionType.
Args |
args
|
Tuple containing positional arguments
|
kwargs
|
Dict containing keyword arguments
|
captures
|
Tuple of tensors supplying captured tensor values.
|
Returns |
A structured output value based on the inputs.
|
__call__
View source
__call__(
*args, **kwargs
)
Executes this callable.
This behaves like a regular op - in eager mode, it immediately starts
execution, returning results. In graph mode, it creates ops which return
symbolic TensorFlow values (like tf.Tensor
, tf.data.Dataset
,
etc.). For example, tf.function
callables typically generate a
tf.raw_ops.PartitionedCall
op, but not always - the
exact operations being generated are an internal implementation detail.
Args |
*args
|
positional argument for this call
|
**kwargs
|
keyword arguments for this call
|
Returns |
The execution results.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2024-04-26 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-04-26 UTC."],[],[],null,["# tf.types.experimental.AtomicFunction\n\n\u003cbr /\u003e\n\n|--------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.16.1/tensorflow/python/types/core.py#L142-L166) |\n\nBase class for graph functions.\n\nInherits From: [`Callable`](../../../tf/types/experimental/Callable)\n\nAn `AtomicFunction` encapsulates a single graph function definition.\n\n`AtomicFunction` can be called directly only if no captures are needed\naccording to the `FunctionType`. If captures are present, please use\n`call_with_captures` instead.\n\n`AtomicFunction` does not support gradients. Please use the parent\n`ConcreteFunction` if you need gradient support.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Attributes ---------- ||\n|-----------------|--------------------------------------------------|\n| `function_type` | Returns a FunctionType describing this callable. |\n\n\u003cbr /\u003e\n\nMethods\n-------\n\n### `call_with_captures`\n\n[View source](https://github.com/tensorflow/tensorflow/blob/v2.16.1/tensorflow/python/types/core.py#L156-L166) \n\n call_with_captures(\n args, kwargs, captures\n )\n\nCalls this AtomicFunction with captures as defined by its FunctionType.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ||\n|------------|----------------------------------------------------|\n| `args` | Tuple containing positional arguments |\n| `kwargs` | Dict containing keyword arguments |\n| `captures` | Tuple of tensors supplying captured tensor values. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ||\n|---|---|\n| A structured output value based on the inputs. ||\n\n\u003cbr /\u003e\n\n### `__call__`\n\n[View source](https://github.com/tensorflow/tensorflow/blob/v2.16.1/tensorflow/python/types/core.py#L124-L139) \n\n __call__(\n *args, **kwargs\n )\n\nExecutes this callable.\n\nThis behaves like a regular op - in eager mode, it immediately starts\nexecution, returning results. In graph mode, it creates ops which return\nsymbolic TensorFlow values (like [`tf.Tensor`](../../../tf/Tensor), [`tf.data.Dataset`](../../../tf/data/Dataset),\netc.). For example, [`tf.function`](../../../tf/function) callables typically generate a\n[`tf.raw_ops.PartitionedCall`](../../../tf/raw_ops/PartitionedCall) op, but not always - the\nexact operations being generated are an internal implementation detail.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ||\n|------------|-----------------------------------|\n| `*args` | positional argument for this call |\n| `**kwargs` | keyword arguments for this call |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ||\n|---|---|\n| The execution results. ||\n\n\u003cbr /\u003e"]]