View source on GitHub |
An ArraySpec
that specifies minimum and maximum values.
Inherits From: ArraySpec
tf_agents.specs.BoundedArraySpec(
shape, dtype, minimum=None, maximum=None, name=None
)
Used in the notebooks
Used in the tutorials |
---|
Example usage:
# Specifying the same minimum and maximum for every element.
spec = BoundedArraySpec((3, 4), np.float64, minimum=0.0, maximum=1.0)
# Specifying a different minimum and maximum for each element.
spec = BoundedArraySpec(
(2,), np.float64, minimum=[0.1, 0.2], maximum=[0.9, 0.9])
# Specifying the same minimum and a different maximum for each element.
spec = BoundedArraySpec(
(3,), np.float64, minimum=-10.0, maximum=[4.0, 5.0, 3.0])
Bounds are meant to be inclusive. This is especially important for integer types. The following spec will be satisfied by arrays with values in the set {0, 1, 2}:
spec = BoundedArraySpec((3, 4), np.int, minimum=0, maximum=2)
Methods
check_array
check_array(
array
)
Return true if the given array conforms to the spec.
from_array
@staticmethod
from_array( array, name=None )
Construct a spec from the given array or number.
from_spec
@classmethod
from_spec( spec, name=None )
Construct a spec from the given spec.
replace
replace(
shape=None, dtype=None, minimum=None, maximum=None, name=None
)
__eq__
__eq__(
other
)
Checks if the shape and dtype of two specs are equal.
__ne__
__ne__(
other
)
Return self!=value.