# Codeblock 7 def object_loss_test(): target = torch.zeros(BATCH_SIZE, S, S, (C+5)) #(1) prediction = torch.zeros(BATCH_SIZE, S, S, (C+B*5)) #(2) target[0, 3, 3, 21:25] = torch.tensor([0.4, 0.5, 2.4, 3.2]) #(3) target[0, 3, 3, 20] = 1.0 #(4) target[0, 3, 3, 7] = 1.0 #(5) prediction[0, 3, 3, 21:25] = torch.tensor([0.4, 0.5, 2.4, 3.2]) #(6) prediction[0, 3, 3, 20] = 1.0 #(7) #prediction[0, 3, 3, 20] = 0.9 #(8) #prediction[0, 3, 3, 20] = 0.6 #(9) target = target.reshape(BATCH_SIZE, S*S*(C+5)) prediction = prediction.reshape(BATCH_SIZE, S*S*(C+B*5)) object_loss = loss(target, prediction)[1] return object_loss object_loss_test()