def METHOD_NAME(self, states):
    if not getattr(states, "encoder_states", None):
        # No encoder states, read a token first
        return READ_ACTION
    # encode previous predicted target tokens
    tgt_indices = self.to_device(
        torch.LongTensor(
            [self.model.decoder.dictionary.eos()]
            + [
                self.dict['tgt'].index(x)
                for x in states.units.target.value
                if x is not None
            ]
        ).unsqueeze(0)
    )
    # Current steps
    states.incremental_states["steps"] = {
        "src": states.encoder_states["encoder_out"][0].size(0),
        "tgt": 1 + len(states.units.target),
    }
    # Online only means the reading is not finished
    states.incremental_states["online"]["only"] = (
        torch.BoolTensor([not states.finish_read()])
    )
    x, outputs = self.model.decoder.forward(
        prev_output_tokens=tgt_indices,
        encoder_out=states.encoder_states,
        incremental_state=states.incremental_states,
    )
    states.decoder_out = x
    torch.cuda.empty_cache()
    if outputs.action == 0:
        return READ_ACTION
    else:
        return WRITE_ACTION