tf_agents.specs.ArraySpec
Stay organized with collections
Save and categorize content based on your preferences.
Describes a numpy array or scalar shape and dtype.
tf_agents.specs.ArraySpec(
shape, dtype, name=None
)
An ArraySpec
allows an API to describe the arrays that it accepts or
returns, before that array exists.
The equivalent version describing a tf.Tensor
is TensorSpec
.
Args |
shape
|
An iterable specifying the array shape.
|
dtype
|
numpy dtype or string specifying the array dtype.
|
name
|
Optional string containing a semantic name for the corresponding
array. Defaults to None .
|
Raises |
TypeError
|
If the shape is not an iterable or if the dtype is an invalid
numpy dtype.
|
Attributes |
dtype
|
Returns a numpy dtype specifying the array dtype.
|
name
|
Returns the name of the ArraySpec.
|
shape
|
Returns a tuple specifying the array shape.
|
Methods
check_array
View source
check_array(
array
)
Return whether the given NumPy array conforms to the spec.
Args |
array
|
A NumPy array or a scalar. Tuples and lists will not be converted
to a NumPy array automatically; they will cause this function to return
false, even if a conversion to a conforming array is trivial.
|
Returns |
True if the array conforms to the spec, False otherwise.
|
from_array
View source
@staticmethod
from_array(
array, name=None
)
Construct a spec from the given array or number.
from_spec
View source
@staticmethod
from_spec(
spec
)
Construct a spec from the given spec.
replace
View source
replace(
shape=None, dtype=None, name=None
)
__eq__
View source
__eq__(
other
)
Checks if the shape and dtype of two specs are equal.
__ne__
View source
__ne__(
other
)
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-04-26 UTC.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Missing the information I need"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Too complicated / too many steps"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Out of date"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Samples / code issue"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
{"lastModified": "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."],[],[]]