Is the below code is wrong?
            print("Input time",time.time() - inp_time)
            # ic(y.shape,Y.shape)
            loss = loss_fn(y,Y)
            avg_loss += loss.item()
            back_time = time.time()
            loss.backward()
'''
Adding the loss.item() to a variable is wrong?
Thank you