| 50 | }; |
| 51 | |
| 52 | uint32 InitialRandomSeed() { |
| 53 | // Support plumbing the TF seed through to XLA is being worked on. |
| 54 | // If a user wants deterministic behavior, their best option |
| 55 | // is to start with a known checkpoint. This also handles issues when |
| 56 | // multiple random calls can be invoked in any order by TF executor. |
| 57 | // Another option is to use stateless random ops. They have much cleaner |
| 58 | // semantics. |
| 59 | // If a user really wants to set a deterministic seed for XLA-based |
| 60 | // devices, this is the place to do it. |
| 61 | std::random_device rd; |
| 62 | // Make the starting value odd. |
| 63 | return rd() | 1; |
| 64 | } |
| 65 | |
| 66 | uint32 GetXLARandomSeed() { |
| 67 | // We initialize counter with an odd number and increment it by two |