Ideally you should not eat 2-3 hours prior to a yoga class. If you must have a snack make it something small and easily digestible. It can be very uncomfortable and may hamper your practice if you have a bloated or full stomach.
Pay attention to your body and how it feels when you eat certain foods and adjust accordingly. After yoga be sure to hydrate with lots of water.