The register_buffer 4 operation includes a persistent argument, which defines if the buffer should be added to the state_dict (it’s set to True by default). If you don’t want to store x_mean and x_std in the state_dict you could thus set it to False for these buffers.