tff.framework.ConcreteComputation
Stay organized with collections
Save and categorize content based on your preferences.
A representation of a pb.Computation
in the tff.Computation
interface.
Inherits From: Computation
, TypedObject
tff.framework.ConcreteComputation(
*,
computation_proto: pb.Computation,
context_stack: tff.framework.ContextStack
,
annotated_type: Optional[tff.types.FunctionType
] = None
)
This implementation exposes methods to retrieve the backing pb.Computation
,
as well as the Python representation of this protocol buffer represented by
an instance of building_blocks.ComputationBuildingBlock
.
Args |
computation_proto
|
The protocol buffer that represents the computation, an
instance of pb.Computation.
|
context_stack
|
The context stack to use.
|
annotated_type
|
Optional, type information with additional annotations
that replaces the information in computation_proto.type .
|
Raises |
TypeError
|
If annotated_type is not None and is not compatible with
computation_proto.type .
|
ValueError
|
If computation_proto.type is None .
|
Attributes |
type_signature
|
Returns the TFF type of this object.
|
Methods
from_building_block
View source
@classmethod
from_building_block(
building_block: tff.framework.ComputationBuildingBlock
) -> 'ConcreteComputation'
Converts a computation building block to a computation impl.
get_proto
View source
@classmethod
get_proto(
value: 'ConcreteComputation'
) -> pb.Computation
to_building_block
View source
to_building_block()
to_compiled_building_block
View source
to_compiled_building_block()
with_type
View source
@classmethod
with_type(
value: 'ConcreteComputation',
type_spec: tff.types.FunctionType
) -> 'ConcreteComputation'
__call__
View source
__call__(
*args, **kwargs
)
Invokes the computation with the given arguments in the given context.
Args |
*args
|
The positional arguments.
|
**kwargs
|
The keyword-based arguments.
|
Returns |
The result of invoking the computation, the exact form of which depends
on the context.
|
__eq__
View source
__eq__(
other: object
) -> bool
Return self==value.
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.
Last updated 2024-09-20 UTC.
[null,null,["Last updated 2024-09-20 UTC."],[],[],null,["# tff.framework.ConcreteComputation\n\n\u003cbr /\u003e\n\n|-------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/federated/blob/v0.87.0 Version 2.0, January 2004 Licensed under the Apache License, Version 2.0 (the) |\n\nA representation of a `pb.Computation` in the [`tff.Computation`](../../tff/Computation) interface.\n\nInherits From: [`Computation`](../../tff/Computation), [`TypedObject`](../../tff/TypedObject) \n\n tff.framework.ConcreteComputation(\n *,\n computation_proto: pb.Computation,\n context_stack: ../../tff/framework/ContextStack,\n annotated_type: Optional[../../tff/types/FunctionType] = None\n )\n\nThis implementation exposes methods to retrieve the backing `pb.Computation`,\nas well as the Python representation of this protocol buffer represented by\nan instance of `building_blocks.ComputationBuildingBlock`.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|---------------------|-------------------------------------------------------------------------------------------------------------------|\n| `computation_proto` | The protocol buffer that represents the computation, an instance of pb.Computation. |\n| `context_stack` | The context stack to use. |\n| `annotated_type` | Optional, type information with additional annotations that replaces the information in `computation_proto.type`. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Raises ------ ||\n|--------------|----------------------------------------------------------------------------------------|\n| `TypeError` | If `annotated_type` is not `None` and is not compatible with `computation_proto.type`. |\n| `ValueError` | If `computation_proto.type` is `None`. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Attributes ---------- ||\n|------------------|--------------------------------------|\n| `type_signature` | Returns the TFF type of this object. |\n\n\u003cbr /\u003e\n\nMethods\n-------\n\n### `from_building_block`\n\n[View source](https://github.com/tensorflow/federated/blob/v0.87.0\nVersion 2.0, January 2004\nLicensed under the Apache License, Version 2.0 (the) \n\n @classmethod\n from_building_block(\n building_block: ../../tff/framework/ComputationBuildingBlock\n ) -\u003e 'ConcreteComputation'\n\nConverts a computation building block to a computation impl.\n\n### `get_proto`\n\n[View source](https://github.com/tensorflow/federated/blob/v0.87.0\nVersion 2.0, January 2004\nLicensed under the Apache License, Version 2.0 (the) \n\n @classmethod\n get_proto(\n value: 'ConcreteComputation'\n ) -\u003e pb.Computation\n\n### `to_building_block`\n\n[View source](https://github.com/tensorflow/federated/blob/v0.87.0\nVersion 2.0, January 2004\nLicensed under the Apache License, Version 2.0 (the) \n\n to_building_block()\n\n### `to_compiled_building_block`\n\n[View source](https://github.com/tensorflow/federated/blob/v0.87.0\nVersion 2.0, January 2004\nLicensed under the Apache License, Version 2.0 (the) \n\n to_compiled_building_block()\n\n### `with_type`\n\n[View source](https://github.com/tensorflow/federated/blob/v0.87.0\nVersion 2.0, January 2004\nLicensed under the Apache License, Version 2.0 (the) \n\n @classmethod\n with_type(\n value: 'ConcreteComputation',\n type_spec: ../../tff/types/FunctionType\n ) -\u003e 'ConcreteComputation'\n\n### `__call__`\n\n[View source](https://github.com/tensorflow/federated/blob/v0.87.0\nVersion 2.0, January 2004\nLicensed under the Apache License, Version 2.0 (the) \n\n __call__(\n *args, **kwargs\n )\n\nInvokes the computation with the given arguments in the given context.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ||\n|------------|------------------------------|\n| `*args` | The positional arguments. |\n| `**kwargs` | The keyword-based arguments. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ||\n|---|---|\n| The result of invoking the computation, the exact form of which depends on the context. ||\n\n\u003cbr /\u003e\n\n### `__eq__`\n\n[View source](https://github.com/tensorflow/federated/blob/v0.87.0\nVersion 2.0, January 2004\nLicensed under the Apache License, Version 2.0 (the) \n\n __eq__(\n other: object\n ) -\u003e bool\n\nReturn self==value."]]