the function:

def loss_function(p, y):
losses = 0
grad_loss = []
for i in range(len§):
temp_p = torch.tensor(p[i])
temp_y = torch.tensor(y[i])
k = len(temp_y)
loss1 = -tensot_mul(vec_minus(one_Vector(k),y[i]), list(np.log(vec_minus(one_Vector(k),p[i]))))
l = y[i]*p[i].log()
prod = vec_minus(vec_minus(one_Vector(k),y[i]), - l)
loss2 = loss1 + sum(softmax(vec_minus(one_Vector(k),prod)))
losses = losses + loss2
returnfloat(losses/(len§))

p - prediction
y - target