Avoid XLA HLO graph structure non-determinism from _VariablesForEMA in lingvo/core/base_model.py
Avoid XLA HLO graph structure non-determinism from _VariablesForEMA in lingvo/core/base_model.py

This is not non-detemrinism in the values computed; it is merely in the shape and
labelling of the computation graph.  We care about this form of non-determinism
because it is helpful to be able to lookup previously-computed properties of
graphs using their structure as a key.

The function _VariablesForEMA in lingvo/core/base_model.py used Python sets to
compute a list of variables that need to apply exponential moving average.
The ordering of that list affects the details of the XLA HLO graph generated.
Python sets are based on hash tables, and the hash function is randomized
on each run for security reasons.  Hence, the use of Python sets can introduce
non-deterinism in the computation graph.

This change uses Python lists to maintain a detministic ordering while performing
the same calculation in the function.

PiperOrigin-RevId: 427564005

tensorflow/lingvo,tensorflow/lingvo,tensorflow/lingvo,tensorflow/lingvo