In my view, this is really a bad naming within pytorch. I would suggest to use something like set_mode('eval') or set_mode('train') instead.