6

x must be a one-dimensional array

Package:
Exception Class:
ValueError

Raise code

``````    control_flow_ops.Assert(N >= 0, [N])

rank = array_ops.rank(x)
rank_temp = np_utils.get_static_value(rank)
if rank_temp is not None:
rank = rank_temp
if rank != 1:
raise ValueError('x must be a one-dimensional array')
else:
control_flow_ops.Assert(math_ops.equal(rank, 1), [rank])

if increasing:
start = 0
limit = N
delta = 1``````
😲 Agile task management is now easier than calling a taxi. #Tracklify
🙏 Scream for help to Ukraine
Today, 25th May 2022, Russia continues bombing and firing Ukraine. Don't trust Russia, they are bombing us and brazenly lying in same time they are not doing this 😠, civilians and children are dying too! We are screaming and asking exactly you to help us, we want to survive, our families, children, older ones.
Please spread the information, and ask your governemnt to stop Russia by any means. We promise to work extrahard after survival to make the world safer place for all.

2

`tf.experimental.numpy.vander `generate a Vandermonde matrix the same way as `numpy.vander`.

Usage:

```result = tf.experimental.numpy.vander(x,
N=None,
increasing=False )
```

x is the input array and N is the number of columns in the output. x should be a 1D array.

Reproducing the error:

```from tensorflow.experimental.numpy import vander
import numpy as np
x = np.array([[1, 2, 3, 5]])
N = 3
result = vander(x,N)
print(result)
```

The error output:

```---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-1-b623fd1eef2a> in <module>
3 x = np.array([[1, 2, 3, 5]])
4 N = 3
----> 5 result = vander(x,N)

~/my_env_project/lib/python3.8/site-packages/tensorflow/python/ops/numpy_ops/np_array_ops.py in vander(x, N, increasing)
1316     rank = rank_temp
1317     if rank != 1:
-> 1318       raise ValueError('x must be a one-dimensional array')
1319   else:
1320     control_flow_ops.Assert(math_ops.equal(rank, 1), [rank])

ValueError: x must be a one-dimensional array
```

Fix:

Make sure the x is 1D array.

```from tensorflow.experimental.numpy import vander
import numpy as np
x = np.array([1, 2, 3, 5])
N = 3
result = vander(x,N)
print(result)
```

Output:

```tf.Tensor(
[[ 1  1  1]
[ 4  2  1]
[ 9  3  1]
[25  5  1]], shape=(4, 3), dtype=int64)
```

Jul 13, 2021
kellemnegasi 29.0k