def METHOD_NAME(self, mode, features, labels, filenames, records, **kwargs):
    labels = [torch.LongTensor(label) for label in labels]
    features_len = torch.IntTensor([len(feat) for feat in features]).to(device=features[0].device)
    features = pad_sequence(features, batch_first=True)
    features = self.projector(features)
    intent_logits, _ = self.model(features, features_len)
    intent_loss = 0
    start_index = 0
    predicted_intent = []
    labels = torch.stack(labels).to(features.device)
    for slot in range(len(self.values_per_slot)):
        end_index = start_index + self.values_per_slot[slot]
        subset = intent_logits[:, start_index:end_index]
        intent_loss += self.objective(subset, labels[:, slot])
        predicted_intent.append(subset.max(1)[1])
        start_index = end_index
    predicted_intent = torch.stack(predicted_intent, dim=1)
    records['acc'] += (predicted_intent == labels).prod(1).view(-1).cpu().float().tolist()
    records['intent_loss'].append(intent_loss.item())
    def idx2slots(indices: torch.Tensor):
        action_idx, object_idx, location_idx = indices.cpu().tolist()
        return (
            self.Sy_intent["action"][action_idx],
            self.Sy_intent["object"][object_idx],
            self.Sy_intent["location"][location_idx],
        )
    records["filename"] += filenames
    records["predict"] += list(map(idx2slots, predicted_intent))
    records["truth"] += list(map(idx2slots, labels))
    return intent_loss