python列表中[2,3]取和[[2,3]]取的区别

logit[2,3]
tensor(0.6992, device='cuda:0', grad_fn=<SelectBackward>)

logit[[2,3]]
tensor([[ 0.0344, -0.3932, -0.1510,  0.6992, -0.1125,  0.1510, -0.1140],
        [-0.2731, -0.1088, -0.0127,  0.4955, -0.6796,  0.4044, -0.2203]],
       device='cuda:0', grad_fn=<IndexBackward>)
posted @ 2022-02-22 22:37  zae  阅读(229)  评论(0编辑  收藏  举报