It  really is the same order. For completeness, here is the inlined code:
def train(model, params, train_dataset, epoch, optimizer, criterion):
    clip = params.get('clip', 10)
    log_interval = params.get('log_interval', 10)
    batch_size = params.get('batch_size', 64)
    sequence_length = params.get('bptt', 50)

    with torch.enable_grad():
        model.train()
        total_loss = 0
        start_time = time.time()
        hidden_teacher = model.init_hidden(batch_size)

        for batch, i in enumerate(range(0, train_dataset.size(0) - 1, sequence_length)):
            input_seq, target_seq = get_batch(sequence_length, train_dataset, i)
            hidden_teacher = model.repackage_hidden(hidden_teacher)
            hidden_freeflow = model.repackage_hidden(hidden_teacher)
            optimizer.zero_grad()

            decoded = input_seq[0].unsqueeze(0)
            decs = []
            hids = []

            # free flow loss
            for _ in range(input_seq.size(0)):
                decoded, hidden_freeflow, output = model.forward(decoded, hidden_freeflow)
                decs.append(decoded)
                hids.append(output)

            out_seq1 = torch.cat(decs, dim=0)
            hids = torch.cat(hids, dim=0)
            loss1 = criterion(out_seq1.contiguous().view(batch_size, -1), target_seq.contiguous().view(batch_size, -1))

            # Teacher forcing loss
            out_seq2, hidden_teacher, output_2 = model.forward(input_seq, hidden_teacher)
            loss2 = criterion(out_seq2.contiguous().view(batch_size, -1), target_seq.contiguous().view(batch_size, -1))

            # Modified/weird professor loss
            loss3 = criterion(hids.contiguous().view(batch_size, -1), output_2.contiguous().view(batch_size, -1).detach())

            loss = loss1 + loss2 + loss3

            loss.backward()
            torch.nn.utils.clip_grad_norm_(model.parameters(), clip)
            optimizer.step()

            total_loss += loss.item()

And this is the only thing that is different. I am baffled.