Describes a numpy array or scalar shape and dtype.

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.

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.

TypeError If the shape is not an iterable or if the dtype is an invalid numpy dtype.

dtype Returns a numpy dtype specifying the array dtype.
name Returns the name of the ArraySpec.
shape Returns a tuple specifying the array shape.



View source

Return whether the given NumPy array conforms to the spec.

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.

True if the array conforms to the spec, False otherwise.


View source

Construct a spec from the given array or number.


View source

Construct a spec from the given spec.


View source


View source

Checks if the shape and dtype of two specs are equal.


View source

Return self!=value.