The efficacy and generalizability of conditional GANs for posterior inference in physics-based inverse problems