tf_agents.bandits.agents.utils.build_laplacian_over_ordinal_integer_actions
Build the unnormalized Laplacian matrix over ordinal integer actions.
tf_agents.bandits.agents.utils.build_laplacian_over_ordinal_integer_actions(
action_spec: tf_agents.typing.types.BoundedTensorSpec
) -> tf_agents.typing.types.Tensor
Assuming integer actions, this functions builds the (unnormalized) Laplacian
matrix of the graph implied over the action space. The graph vertices are the
integers {0...action_spec.maximum - 1}. Two vertices are adjacent if they
correspond to consecutive integer actions. The action_spec
must specify
a scalar int32 or int64 with minimum zero.
Args |
action_spec
|
a BoundedTensorSpec .
|
Returns |
The graph Laplacian matrix (float tensor) of size equal to the number of
actions. The diagonal elements are equal to 2 and the off-diagonal elements
are equal to -1.
|
Raises |
ValueError
|
if action_spec is not a bounded scalar int32 or int64 spec
with minimum 0.
|
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."],[],[]]