In following code i want to check the shape of each array afer i use :-1 and -1. I thougt that would be x.shape= [2,4,3] ,y.shape =[2,1,3]. But out put is x.shape= [2,4,3], y.shape=[2,3]. I'm confussed where is the second dimmension of y?
thanks a lot if some friends could help me to figure it out.
#code--
import numpy as np
a = np.random.rand(2,5,3)
print(a)
x = a[:,:-1,:]
y = a[:,-1,:]
print(x.shape)
print(y.shape)
#output
[[[0.18648295 0.45018899 0.37269369]
[0.28727699 0.74595982 0.24410613]
[0.73484484 0.62852367 0.71091093]
[0.82692484 0.93791066 0.31497567]
[0.5506998 0.3992407 0.55229818]]
[[0.33900664 0.37279058 0.59162413]
[0.18841992 0.94866945 0.7417921 ]
[0.67865254 0.61119384 0.49094303]
[0.07091689 0.55436234 0.80671508]
[0.37598695 0.96572699 0.04268124]]]
(2, 4, 3)
(2, 3)
i expect some one could answer my question.your text