The court committing a ward to the Youth Authority may thereafter change, modify, or set aside the order of commitment. Ten days' notice of the hearing of the application therefor shall be served upon the Director of the Youth Authority. In changing, modifying, or setting aside the order of commitment, the court shall give due consideration to the effect thereof upon the discipline and parole system of the Youth Authority or of the correctional school in which the ward may have been placed by the Youth Authority. Except as provided in this section, nothing in this chapter shall be deemed to interfere with the system of parole and discharge now or hereafter established by law, or by rule of the Youth Authority, for the parole and discharge of wards of the juvenile court committed to the Youth Authority, or with the management of any school, institution, or facility under the jurisdiction of the Youth Authority. Except as provided in this section, this chapter does not interfere with the system of transfer between institutions and facilities under the jurisdiction of the Youth Authority. This section does not limit the authority of the court to change, modify, or set aside an order of commitment after a noticed hearing and upon a showing of good cause that the Youth Authority is unable to, or failing to, provide treatment consistent with Section 734.
However, before any inmate of a correctional school may be transferred to a state hospital, he or she shall first be returned to a court of competent jurisdiction and, after hearing, may be committed to a state hospital for the insane in accordance with law.
Ca. Welf. and Inst. Code § 779