Tensor

The np.array and np.ndarray are tensor.

Array

Simple access will reduce the dimension


In [2]:
import numpy as np
test = np.array([[1, 2], [3, 4], [5, 6]])

In [3]:
test[:,0]


Out[3]:
array([1, 3, 5])

In [4]:
test[1,:]


Out[4]:
array([3, 4])

In [5]:
test[:,[0]]


Out[5]:
array([[1],
       [3],
       [5]])

In [ ]: