tf.experimental.numpy.ndarray
Equivalent of numpy.ndarray backed by TensorFlow tensors.
tf.experimental.numpy.ndarray( shape, dtype=float, buffer=None )
This does not support all features of NumPy ndarrays e.g. strides and memory order since, unlike NumPy, the backing storage is not a raw memory buffer.
or if there are any differences in behavior.
Args | |
---|---|
shape | The shape of the array. Must be a scalar, an iterable of integers or a TensorShape object. |
dtype | Optional. The dtype of the array. Must be a python type, a numpy type or a tensorflow DType object. |
buffer | Optional. The backing buffer of the array. Must have shape shape . Must be a ndarray , np.ndarray or a Tensor . |
Raises | |
---|---|
ValueError | If buffer is specified and its shape does not match shape . |
Attributes | |
---|---|
T | |
data | Tensor object containing the array data. This has a few key differences from the Python buffer object used in NumPy arrays.
|
dtype | |
ndim | |
shape | Returns a tuple or tf.Tensor of array dimensions. |
size | Returns the number of elements in the array. |
Methods
astype
astype( dtype )
clip
clip( a, a_min, a_max )
TensorFlow variant of NumPy's clip
.
Unsupported arguments: out
, kwargs
.
See the NumPy documentation for numpy.clip
.
from_tensor
@classmethod from_tensor( tensor )
ravel
ravel( a )
TensorFlow variant of NumPy's ravel
.
Unsupported arguments: order
.
See the NumPy documentation for numpy.ravel
.
reshape
reshape( a, *newshape, **kwargs )
tolist
tolist()
transpose
transpose( a, axes=None )
TensorFlow variant of NumPy's transpose
.
See the NumPy documentation for numpy.transpose
.
__abs__
__abs__( x )
TensorFlow variant of NumPy's absolute
.
Unsupported arguments: out
, where
, casting
, order
, dtype
, subok
, signature
, extobj
.
See the NumPy documentation for numpy.absolute
.
__add__
__add__( a, b )
__bool__
__bool__()
__eq__
__eq__( a, b )
__floordiv__
__floordiv__( a, b )
__ge__
__ge__( a, b )
__getitem__
__getitem__( slice_spec )
Implementation of ndarray.getitem.
__gt__
__gt__( a, b )
__invert__
__invert__( x )
TensorFlow variant of NumPy's logical_not
.
Unsupported arguments: out
, where
, casting
, order
, dtype
, subok
, signature
, extobj
.
See the NumPy documentation for numpy.logical_not
.
__iter__
__iter__()
__le__
__le__( a, b )
__len__
__len__()
__lt__
__lt__( a, b )
__matmul__
__matmul__( a, b )
__mod__
__mod__( a, b )
__mul__
__mul__( a, b )
__ne__
__ne__( a, b )
__neg__
__neg__()
__nonzero__
__nonzero__()
__pos__
__pos__()
__pow__
__pow__( a, b )
__radd__
__radd__( a, b )
__rfloordiv__
__rfloordiv__( a, b )
__rmatmul__
__rmatmul__( a, b )
__rmod__
__rmod__( a, b )
__rmul__
__rmul__( a, b )
__rpow__
__rpow__( a, b )
__rsub__
__rsub__( a, b )
__rtruediv__
__rtruediv__( a, b )
__sub__
__sub__( a, b )
__truediv__
__truediv__( a, b )
© 2020 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/versions/r2.4/api_docs/python/tf/experimental/numpy/ndarray