Skip to content
Snippets Groups Projects
Commit 73e38363 authored by Mark Daoust's avatar Mark Daoust Committed by TensorFlower Gardener
Browse files

Add __array__ method to `tf.Variable`.

`np.array` converts a `tf.Tensor`. It should work on a `tf.Variable` too.

This seems like the right class to add it to since this is the class that implements `.numpy()` for Variable.

```
>>> np.array(tf.Variable([1.0]))
array([1.], dtype=float32)
```

PiperOrigin-RevId: 322345276
Change-Id: I66a6e19f66ed444f0f0bdbd48e340ef76e443e20
parent 3a6dd9b8
Branches
Tags
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment