not sure where you live and the rules may differ
when in doubt, ask the hospital
some places give you more leeway if the admission is voluntary, but even that may not be much and once you're in, you may have to meet specific conditions before you get released - those usually include attending the therapy sessions, taking your meds, and generally showing some kind of overall improvement
you may not even be allowed outside for a breath of fresh air until the doctors say it's alright
this is information that i didn't have before i signed myself in - it definitely would have made things easier if i had know some of this beforehand
hope it helps and that it works out for you