Add an option to return non-shared variables in make_layer_to_state.

This is not implemented yet, only the flag argument has been added.