my model is like below:
class Net(nn.Module):
    
    def __init__(self):
        super().__init__()
        self.fc1 = nn.Linear(4909, 1500)
        self.relu1 = nn.ReLU()
        self.dout = nn.Dropout(0.2)
        self.fc2 = nn.Linear(1500, 300)
        self.prelu = nn.PReLU(1)
        self.out = nn.Linear(300, 1)
        self.out_act = nn.Sigmoid()
        
    def forward(self, input_):
        a1 = self.fc1(input_)
        h1 = self.relu1(a1)
        dout = self.dout(h1)
        a2 = self.fc2(dout)
        h2 = self.prelu(a2)
        a3 = self.out(h2)
        y = self.out_act(a3)
        return y

and… define my model and loss function & optimizer function
model = Net()

criterion = nn.BCEWithLogitsLoss()
optimizer = optim.Adam(model.parameters(), lr=0.01, betas=(0.9, 0.999))

now start to train:
def train(epoch):
    model.train()
    for i in range(len(x_train_tensor)):
        optimizer.zero_grad()
        output = model(x_train_tensor[i])
        print(output.data[0], y_train_tensor[i])
        loss = criterion(output.data[0], y_train_tensor[i])
        loss.backward()
        optimizer.step()
        losses.append(loss.data[0])
        print("loss: {}".format(loss.data[0]))

but… output is like below

tensor(0.4984) tensor(1., grad_fn=)
loss: 0.47467532753944397
tensor(0.5021) tensor(1., grad_fn=)
loss: 0.4732956886291504
tensor(0.5000) tensor(0., grad_fn=)
loss: 0.9740557670593262
tensor(0.4942) tensor(1., grad_fn=)

when the label is 1 loss value is almost 0.4, but when a label is 0 loss function up to 0.9. these values repeat and don’t go to low value.
How can I resolve it? thank you!