How to fix this error: list indices must be integers or slices, not tuple
Suppose I have a list of tensors called outputs

&gt;&gt; outputs[2][0][0,:,:]
Out[20]: 
tensor([[ 14.0448,  -5.1494,  -0.1780,  ...,  10.1937,  -8.9158,  -5.3964],
        [ 32.0382,  -0.5201,  29.9942,  ..., -18.8268, -23.1068,  23.9745],
        [-24.5911,  14.7233,  -6.3053,  ...,  -5.8131,  -3.3088,   0.5685],
        [  0.8842, -14.8318,   6.7204,  ...,  17.7127,   7.3332,   3.7249],
        [  2.0654, -16.5236,  38.3582,  ..., -23.1663,  -5.1202,  13.6506]],
       grad_fn=&lt;SliceBackward&gt;)


&gt;&gt; outputs[2][1][0,:,:]
Out[24]: 
tensor([[-0.1260,  0.0463, -0.3362,  ...,  0.1089, -0.2454,  0.0140],
        [ 0.5050, -0.0750, -0.1639,  ..., -0.0020, -0.0521, -0.3224],
        [-0.5311,  0.4526,  0.0079,  ..., -0.0654, -0.1255, -0.0012],
        [ 0.0728, -0.1219,  0.0905,  ...,  0.1354,  0.2730, -0.1186],
        [-0.0680, -0.5570,  0.0295,  ..., -0.2411, -0.1690,  0.0331]],
       grad_fn=&lt;SliceBackward&gt;)


When I try to do:

&gt;&gt; outputs[2][0:1][0,:,:]


python generates an error, and the error message is 

TypeError: list indices must be integers or slices, not tuple


How can I fix this error?

Thank you,

outputs[2][0] and outputs[2][1] both return an object (tensor I suppose).
outputs[2][0:1] returns a list of those objects.
What I think you are looking for is something like outputs[2][0:1][:,0,:,:] or [a[0,:,:] for a in outputs[2][0:1]]
