slicing each raw of a tensor
I have a tensor of size (1124823 x 13). I want to go from the center of each raw of the tensor take five elements from the left and five from the right. I do such this simple code. It gives me

TypeError: iteration over a 0-d tensor

i = 0
j = 6
base = feat.size(0)//2
for i in feat[i, j]:
    x = feat[base - 5: base:+5]
    i += 1


What about this:

x = torch.rand(100,13) 
center = x.size(1) // 2                                                 
x1 = x[:, center:center+5] # torch.Size([100, 5]) (right)
x2 = x[:, center-5:center] # torch.Size([100, 5]) (left)


Is that what you want?
