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 tup