def METHOD_NAME(self,
            tgt,
            memory,
            cache):
    mask = subsequent_mask(tgt.size(-1)).unsqueeze(0)  # (B, T)
    x = self.embed(tgt)
    mask = self.prepare_mask(mask)
    new_cache = []
    for c, decoder in zip(cache, self.model.decoders):
        x, mask = decoder(x, mask, memory, None, c)
        new_cache.append(x)
        x = x[:, 1:, :]
    if self.model.normalize_before:
        y = self.model.after_norm(x[:, -1])
    else:
        y = x[:, -1]
    if self.model.output_layer is not None:
        y = torch.log_softmax(self.model.output_layer(y), dim=-1)
    return y, new_cache