It seems the slicing is not supported for nn.Sequential. For example,
import torch.nn as nn
net = nn.Sequential()
net.add_module('first', nn.Linear(2, 2))
net.add_module('second', nn.Linear(3, 3))
net.add_module('third', nn.Linear(4, 4))
for fc in net[:-1]:
print(fc)
Then it has the error TypeError: '<=' not supported between instances of 'int' and 'slice'