def switch_training(self, flag):
if self._is_training == flag: return<EOL>self._is_training = flag<EOL>if flag:<EOL><INDENT>self._training_flag.set_value(<NUM_LIT:1>)<EOL><DEDENT>else:<EOL><INDENT>self._training_flag.set_value(<NUM_LIT:0>)<EOL><DEDENT>
Switch training mode.
:param flag: switch on training mode when flag is True.