Not exactly...in order to exit the submarine, you have to pressurize the escape hatch to overcome pressure at depth. That means your lungs would be carrying equivalent pressure, and you would have to exhale on the ascent, or you would suffer an embolism. At some point, you couldn’t hold the air in anyway.