What is the meaning of keep_vars in state_dict?
state_dict(destination=None, prefix='', keep_vars=False)

what does changing keep_vars to True do?

In PyTorch >=0.4, it has no use.

keep_vars was added in the commit: Add keep_vars parameter to state_dict stating that 


  When keep_vars is true, it returns a Variable for each parameter
          (rather than a Tensor).


In state_dict function, _save_to_state_dict is called internally, which contains the following code

for name, param in self._parameters.items():
            if param is not None:
                destination[prefix + name] = param if keep_vars else param.data
        for name, buf in self._buffers.items():
            if buf is not None:
                destination[prefix + name] = buf if keep_vars else buf.data


The portion param if keep_vars else param.data made difference prior to PyTorch 0.4.0 when Variable and Tensor were separate, but now as they are merged, keep_vars is probably present only for backward compatibility. Check Is .data still useful in pytorch?
