A[...,1] and a[...,1:2] are often used in array calls>
1 import tensorflow as tf2 import numpy as np3 a = np.array([[[1,2,21],[3,4,34]],[[5,6,56],[7,8,78]]])4 print('a.shape:',a.shape)56 b = a[...,0:2]7 print('b:',b)8 print('shape.b:',b.shape)
The results are as follows:
a.shape: (2, 2, 3)b : [[[1 2][3 4]][[5 6][7 8]]]shape.b: (2, 2, 2)
But if a[...,1] is used, the result is as follows:
a.shape: (2, 2, 3)b : [[2 4][6 8]]shape.b: (2, 2)
You can see that [...,1:3] represents the number of 1:3 in the last dimension, the input is the array of the last dimension in the original dimension, and [...,2] isThe information in the -2 dimension, the input is one dimension less than the original dimension.