def test(model, device, dataloader):
    model.reset_iv()
    model.eval()
    num_batches = len(dataloader)
    num_cols = len(model.building.rooms)
    test_loss = 0
    loss_fn = torch.nn.MSELoss()
    with torch.no_grad():
        for (time, temp) in dataloader:
            (time, temp) = (time.to(device), temp.to(device))
            time = time.squeeze(0)
            temp = temp.squeeze(0)
            pred = model(time)
            pred = pred.squeeze((- 1))
            test_loss += loss_fn(pred[:, 2:], temp[:, 0:num_cols]).item()
            model.iv = pred[(- 1), :].unsqueeze(1).detach()
    test_loss /= num_batches
    return test_loss
def test(model, device, dataloader):
    model.reset_iv()
    model.eval()
    num_batches = len(dataloader)
    num_cols = len(model.building.rooms)
    test_loss = 0
    loss_fn = torch.nn.MSELoss()
    with torch.no_grad():
        for (time, temp) in dataloader:
            (time, temp) = (time.to(device), temp.to(device))
            time = time.squeeze(0)
            temp = temp.squeeze(0)
            pred = model(time)
            pred = pred.squeeze((- 1))
            test_loss += loss_fn(pred[:, 2:], temp[:, 0:num_cols]).item()
            model.iv = pred[(- 1), :].unsqueeze(1).detach()
    test_loss /= num_batches
    return test_loss