Hi,
Apologies if my model itself is downright trash, please correct in that case. I am just learning pytorch.
So, I am trying to do sentiment analysis on imdb dataset. 1-gram, sending the word index to the embedding-bag, then single fc layer.

class ffn(nn.Module):
    def __init__(self):
        super().__init__()
        self.embedBag = nn.EmbeddingBag(1000, 20,sparse=True)
        self.fc = nn.Linear(20, 1)
        
    def forward(self, x):
        x = self.embedBag(x)
        y = self.fc(x)
        return t.sigmoid(y)

 
mod = ffn()
#using batch_size 1 so that no padding is required
imdb_data = t.utils.data.DataLoader(imdb_ds(train_x, train_y),batch_size=1)
optim = t.optim.Adagrad(mod.parameters(), lr=0.001 )

loss_ls = []
for i,(x,y) in enumerate(imdb_data):
    optim.zero_grad()
    ybar = mod(x)
    loss = F.binary_cross_entropy(ybar,t.tensor(y,dtype=t.float32))
    loss_ls.append(loss.item())
    loss.backward()
    optim.step()
    if i%5000==0: print(loss)

Is there a problem with loss? Is sigmoid giving problem? My loss is just stuck around 0.7, randomly fluctuating.