Q1: How does BatchNorm1d() judge the current forward() is training or inference? Is there some parameters can be observed and setted manually?
Q2: Specifically speaking, I’m trying to implement a reinforcement learning task. While in the training process, the transition tuple <state, action, state_next, reward> has to be generated one by one calling forward(), the state is input and the reward and the action are outputs, and then is add to the experience reply memory for the subsequent minibatch optimization, which means in the process of generating the transition tuple, the batch size of the input of forward() is 1.  Hence, the BatchNorm1d() can not work because the standard deviation is 0. How to deal with the problem effectively? My existing simple idea is to randomly generate some transition tuple not using forward() for initialization. Is there some effectively and professional methods?
Thanks.