tf_agents.bandits.policies.constraints.InputNetworkConstraint
Stay organized with collections
Save and categorize content based on your preferences.
Class for representing a constraint using an input network.
Inherits From: BaseConstraint
tf_agents.bandits.policies.constraints.InputNetworkConstraint(
time_step_spec: tf_agents.typing.types.TimeStep
,
action_spec: tf_agents.typing.types.BoundedTensorSpec
,
input_network: Optional[tf_agents.typing.types.Network
] = None,
name: Optional[Text] = 'InputNetworkConstraint'
)
This constraint class uses an input network to compute the action feasibility.
It assumes that the input network is already trained and it can be provided
at construction time or later using the set_network() function.
Args |
time_step_spec
|
A TimeStep spec of the expected time_steps.
|
action_spec
|
A nest of BoundedTensorSpec representing the actions.
|
input_network
|
An instance of tf_agents.network.Network used to provide
estimates of action feasibility.
|
name
|
Python str name of this agent. All variables in this module will
fall under that name. Defaults to the class name.
|
Methods
compute_loss
View source
compute_loss(
observations: tf_agents.typing.types.NestedTensor
,
actions: tf_agents.typing.types.NestedTensor
,
rewards: tf_agents.typing.types.Tensor
,
weights: Optional[types.TensorOrArray] = None,
training: bool = False
) -> tf_agents.typing.types.Tensor
__call__
View source
@abc.abstractmethod
__call__(
observation, actions=None
)
Returns the probability of input actions being feasible.
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-04-26 UTC.
[null,null,["Last updated 2024-04-26 UTC."],[],[],null,["# tf_agents.bandits.policies.constraints.InputNetworkConstraint\n\n\u003cbr /\u003e\n\n|--------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/agents/blob/v0.19.0/tf_agents/bandits/policies/constraints.py#L499-L554) |\n\nClass for representing a constraint using an input network.\n\nInherits From: [`BaseConstraint`](../../../../tf_agents/bandits/policies/constraints/BaseConstraint) \n\n tf_agents.bandits.policies.constraints.InputNetworkConstraint(\n time_step_spec: ../../../../tf_agents/typing/types#TimeStep,\n action_spec: ../../../../tf_agents/typing/types#BoundedTensorSpec,\n input_network: Optional[../../../../tf_agents/typing/types#Network] = None,\n name: Optional[Text] = 'InputNetworkConstraint'\n )\n\nThis constraint class uses an input network to compute the action feasibility.\nIt assumes that the input network is already trained and it can be provided\nat construction time or later using the set_network() function.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|------------------|--------------------------------------------------------------------------------------------------------------------|\n| `time_step_spec` | A `TimeStep` spec of the expected time_steps. |\n| `action_spec` | A nest of `BoundedTensorSpec` representing the actions. |\n| `input_network` | An instance of `tf_agents.network.Network` used to provide estimates of action feasibility. |\n| `name` | Python str name of this agent. All variables in this module will fall under that name. Defaults to the class name. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Attributes ---------- ||\n|-----------|---------------|\n| `network` | \u003cbr /\u003e \u003cbr /\u003e |\n\n\u003cbr /\u003e\n\nMethods\n-------\n\n### `compute_loss`\n\n[View source](https://github.com/tensorflow/agents/blob/v0.19.0/tf_agents/bandits/policies/constraints.py#L540-L549) \n\n compute_loss(\n observations: ../../../../tf_agents/typing/types/NestedTensor,\n actions: ../../../../tf_agents/typing/types/NestedTensor,\n rewards: ../../../../tf_agents/typing/types/Tensor,\n weights: Optional[types.TensorOrArray] = None,\n training: bool = False\n ) -\u003e ../../../../tf_agents/typing/types/Tensor\n\n### `__call__`\n\n[View source](https://github.com/tensorflow/agents/blob/v0.19.0/tf_agents/bandits/policies/constraints.py#L552-L554) \n\n @abc.abstractmethod\n __call__(\n observation, actions=None\n )\n\nReturns the probability of input actions being feasible."]]