Whenever any person is acquitted on the ground that, at the time the offence was allegedly committed, he was, due to unsoundness of mind, incapable of knowing the nature of the act or that it was wrong or contrary to law, the judgment shall specifically state whether the person committed the act or not.