A wrong approach :
# hypothesis x shape (1,768)
np.shape(x)
# Every time a new one-dimensional matrix is generated a(1,768) Make it a x The next line :
x.append(a)
The results are displayed x The shape of is (2,1,768), This is obviously wrong
The form we want is (2,768)
Use np.vstack()
Methods and np.hstack
Method
The former makes the new matrix splice at the bottom of the existing matrix , Become a new line
The latter makes the new matrix splice on the right side of the existing matrix , It becomes a new column
# hypothesis x shape (1,768)
# Every time a new one-dimensional matrix is generated a(1,768) Make it a x The next line :
x = np.vstack((x, a))
np.shape(x) # The result is (2,768)