Understanding the [:,1] in tf.stack

Viewed 39

Hello I am new to python and tensorflow. I read the code about swapping x and y coordiantes from bounding boxes and i am not sure if i understand the code correctly.

def swap_xy(boxes):
 return tf.stack([boxes[:, 1], boxes[:, 0], boxes[:, 3], boxes[:, 2]], axis=-1)

with tf.stack I pack a list of tensor and build a new tensor with 1 rank higher. But I dont understand the negativ axis = -1 and I dont understand what happen in the list of tensor. I was thinking that the 1, 0, 3, and 2 change the order of the list of tensor. But what does the : operator mean?

1 Answers

well this : is use to select all value example

lst=[1,2,3,4]
print(lst[:2])
#output
[1,2]
Related