Trying to replicate the code below and I get the error “IndexError: Target 1 is out of bounds.” What could be the problem
class TexNet(nn.Module):
def init(self):
super(TexNet, self).init()
    self.fc = nn.Linear(256, 1)
    self.feature1 = nn.Sequential(
            STNet(),
            Stim(),
            Text()
            )
    self.inp = 0
    
def forward(self, x):
    x11 = self.feature1(x)
    x1 = x11.view(-1, 256)
    x1 = self.fc(x1) 
    self.inp = x1
    return x1, x11

model1 = TexNet().to(device)
model2.train()
model3.train()
criterion1 = nn.CrossEntropyLoss()
criterion2 = nn.MSELoss()
criterion3 = nn.CrossEntropyLoss()
train_dataset = torchvision.datasets.ImageFolder(root=’./images/’,
transform=Transform)
train_loader=torch.utils.data.DataLoader(train_dataset, batch_size=1, shuffle=True)
for j in range (10):
model1.train()

for i, data in enumerate(train_loader):
    inputs, target = data[0].to(device), data[1].to(device)
    target_f = torch.Tensor.float(target)


    optimizer1.zero_grad()
    optimizer2a.zero_grad()
    optimizer2b.zero_grad()


    output1 = model1(inputs)[0]
output2a = model2(inputs)
    output2b = model3(inputs)[0]

    loss = (criterion1(F.softmax(output1),target) + criterion2(output2a, target_f) + 
            criterion3(F.softmax(output2b), target))