tf.experimental.numpy.ndarray

Equivalent of numpy.ndarray backed by TensorFlow tensors.

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.

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.

ValueError If buffer is specified and its shape does not match shape.

T

data Tensor object containing the array data.

This has a few key differences from the Python buffer object used in NumPy arrays.

  1. Tensors are immutable. So operations requiring in-place edit, e.g. setitem, are performed by replacing the underlying buffer with a new one.
  2. Tensors do not provide access to their raw buffer.
dtype

ndim

shape Returns a tuple or tf.Tensor of array dimensions.
size Returns the number of elements in the array.

Methods

astype

View source

clip

View source

TensorFlow variant of NumPy's clip.

Unsupported arguments: out, kwargs.

See the NumPy documentation for numpy.clip.

from_tensor

View source

ravel

View source

TensorFlow variant of NumPy's ravel.

Unsupported arguments: order.

See the NumPy documentation for numpy.ravel.

reshape

View source

tolist

View source

transpose

View source

TensorFlow variant of NumPy's transpose.

See the NumPy documentation for numpy.transpose.

__abs__

View source

TensorFlow variant of NumPy's absolute.

Unsupported arguments: out, where, casting, order, dtype, subok, signature, extobj.

See the NumPy documentation for numpy.absolute.

__add__

View source

__bool__

View source

__eq__

View source

__floordiv__

View source

__ge__

View source

__getitem__

View source

Implementation of ndarray.getitem.

__gt__

View source

__invert__

View source