hi, i built a loss function, and the backward is very slow:
 def loss_function(p, y, b):
     eps = 0.0000000001
     losses = 0
     k = len(y[0])
     ones = torch.ones(k).cuda()
     for i in range(b):
         loss1 = -((ones-y[i])@(((ones-p[i])+(eps)).log()))
         prod = (ones-y[i])*k - y[i]*((p[i]+ eps).log())
         loss2 = torch.min(prod)
         losses = losses + (loss2 + loss1)
     return (losses/b)

and also, what should be the ratio between the size of the data, and the size of the batch?
i have ~300,000 rows in my dataset, maybe a better choice of batch size would help here?
my model is a CNN, with 3 conv layers and 2 linear layers