19.6. Random seeds

popxl.random_seed.create_seeds(seed, offset=0, batches_per_step=1, gradient_accumulation_factor=1, replicas=1)

Create seed tensors from a parent seed.

A seed tensor is a uint64 value represented as two uint32 elements. The function creates a NumPy array containing batches_per_step * gradient_accumulation_factor * replicas seed tensors. The result is a tensor with shape [batches_per_step, gradient_accumulation_factor, replicas, 2].

  • seed (int) – Seed value for the random number generator.

  • offset (int) – Offset added to seed.

  • batches_per_step (int, optional) – Number of batches per step. Defaults to 1.

  • replicas (int, optional) – Number of model replications. Defaults to 1.

  • gradient_accumulation_factor (int, optional) – Gradient accumulation factor of model. Defaults to 1.


The initialised seed tensors.

Return type


popxl.random_seed.two_uint32_to_uint64(a, b)

Convert two uint32 values to a uint64.

a is the most-significant 32 bits and b is the least-significant 32 bits.

Return type



Convert uint64 to two uint32 values.

The return values are the most-significant 32 bits and least-significant 32 bits.


num (int) –

Return type

Tuple[int, int]