'The feeling of shame and dislike is the principle of righteousness.' (Mencius 3.6) 'It is only the (truly) virtuous man, who can love, or who can hate, others.' (Analects 4.3) If a murderer has committed a morally atrocious crime, and the law takes no action against him or her, then the law is unjust.
Even if a prisoner has a short term memory, their muscle memory and their nerve network will still give them the feeling that they can kill a person with no remorse. Whenever normal people try to kill people their muscle memory will stop them short with fear of taking someone's life. Even if your brain does not register the possible punishment in your head. Murderers become free from those inhibitions and even with a short term memory their next kill is just a nerve trigger away.
The actual mechanism in a person's mind that can be used to explain criminal behavior is not known; it cannot be said for certain that a person who does not remember a crime is still capable of committing one again. And vilifying a person who does not remember committing a crime accomplishes little, especially if they genuinely regret being responsible for it (if they can be convinced that it happened). Still, it is important for the criminal justice system to function normally for the sake of societal stability. If someone commits a crime, whether they are aware of it or not, they go to jail. If it were possible to defend yourself by claiming that you have no memory of the crime, I imagine a great many criminals would start complaining of amnesia.
Which remains unchanged and un-erased which took the decision for the same. Thus this criminal act might reoccur especially in the absence of a mechanism to build memory, since this will also ensure an absence of guilt, which could otherwise have changed the person, his personality and his morals and virtues
If you made the decision to commit murder, you should be punished. The fact you don't remember should not be a crutch for you to hide behind, because you consciously committed the crime in the first place. Also, if you are violent enough to commit murder, you should not be out on the street, risking everyone else's lives.
In the eyes of the law, memory loss is not an excuse for a crime committed. If an individual is convicted of murder then a fitting custodial sentence is due. If a convict was spared a custodial sentence on the basis of memory loss then it would set a murky precedence in case law.
Therefore a convict should go to prison, so that the law of the land is upheld.
If the issue was around the question of whether the convict would learn from his/her crime then the coin flips on the other side for evaluation.
If the the criminal has amnesia, then this version of the person's mind never committed a crime. And if this so-called "justice" system is supposed to teach the criminals a lesson, then if they do not remember, they will not get the message. If you jail a criminal who doesn't remember the crime, then this is an act of vengeance. Though it would be vengeance if they did remember, but this is more vengeful.