My chemistry professor shut the door at class time and made fun of anyone who came in late. "I got up on time! Why can't you get up on time?!" He did not appreciate anyone yawning. "When you yawn, put your fist in your face!" He did not like hats, either. Somehow, he was irate, funny, but not wholly serious, at the same time.
I sometimes slept in early morning classes and in afternoon classes. I chose my desk so that I could lean back against the wall to facilitate sleeping. In calculus, my regular teacher was not harsh with sleeping. She knew I was making high As anyway. But we had a substitute one day who pontificated upon my sleeping to the effect that, "You can't amount to anything sleeping in math class. Maybe you can be a janitor, but that's about all." After I got my PhD I had to remind him about that. He did not remember it, of course.
I slept a lot in linear algebra. I already knew about dot products, Jacobians, and eigenvalues, so it was not a big loss. Well, there was some loss. I had an 89.25% average. For almost all students that would be close enough for an A (the extra .25% was the difference between getting a 7 instead of an 8 on a subjectively graded homework problem). But, for me, 89.25% was a B, probably because I slept so much. Once in linear algebra I woke up and everybody was leaving the classroom. A cute Chinese girl grinnedat me. I wondered what I had done in my sleep.
In graduate school I was always either very interested or very worried that I would miss something, so I never slept in class.
I dwell on sleeping so much because I never did anything else that would upset my professors. I did not wear a hat. I do not ever remember being very late to class. I did not talk a lot in class--I was either sleeping or paying attention.