I hope you understand my lack of English.
    self.list5 = [1,2,3,4,5]
    self.floor1list = nn.ModuleList([self.fc1, self.fc2, self.fc3, self.fc4, self.fc5])


def forward(self, x, input_num):
    select = random.sample(self.list5, input_num.item())

    x1 = x[:, :2700]
        
    for j,i in zip(range(input_num), select):
        x1 += self.leaky(self.floor1list[i-1](torch.cat((x[:,:2700], x[:,2700+5400*j:2700+5400*(j+1)]))))
    x1 = self.sigmoid(x1)
    return x1

---> 48         x1 = x[:, :2700]
TypeError: unhashable type: 'slice'

---> 45         select = random.sample(self.list5, input_num.item())
ValueError: only one element tensors can be converted to Python scalars

---> 50         for j,i in zip(range(input_num), [1,2,3,4,5]):
TypeError: only integer tensors of a single element can be converted to an index

batch size = 8
x size = 8x32400
input_num size = 8x1
Force different sizes of inputs to the same size, So I get input_num.
I’d like to select random layers according to input_num.
Errors occur on almost all lines      
Is there a better way?