# tf.make_ndarray

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.13.1/tensorflow/python/framework/tensor_util.py#L629-L716) |

Create a numpy ndarray from a tensor.

#### View aliases


**Compat aliases for migration**

See
[Migration guide](https://www.tensorflow.org/guide/migrate) for
more details.

[`tf.compat.v1.make_ndarray`](https://www.tensorflow.org/api_docs/python/tf/make_ndarray)

<br />

    tf.make_ndarray(
        tensor
    )

Create a numpy ndarray with the same shape and data as the tensor.

#### For example:

    # Tensor a has shape (2,3)
    a = tf.constant([[1,2,3],[4,5,6]])
    proto_tensor = tf.make_tensor_proto(a)  # convert `tensor a` to a proto tensor
    tf.make_ndarray(proto_tensor) # output: array([[1, 2, 3],
    #                                              [4, 5, 6]], dtype=int32)
    # output has shape (2,3)

<br />

<br />

<br />

| ## Args ||
|---|---|
| `tensor` | A TensorProto. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A numpy array with the tensor contents. ||

<br />

<br />

<br />

<br />

| ## Raises ||
|---|---|
| `TypeError` | if tensor has unsupported type. |

<br />