Configuration

Sionna’s configuration API. It can be used to set global variables which can be used by all modules and functions.

class sionna.config.Config[source]

Sionna configuration class

This singleton class is used to define global configuration variables and random number generators that can be accessed from all modules and functions. It is instantiated immediately and its properties can be accessed as “sionna.config.desired_property”.

property np_rng

NumPy random number generator

import sionna
sionna.config.seed = 42 # Set seed for deterministic results

# Use generator instead of np.random
noise = sionna.config.np_rng.normal(size=[4])
Type:

np.random.Generator

property py_rng

Python random number generator

import sionna
sionna.config.seed = 42 # Set seed for deterministic results

# Use generator instead of random
int = sionna.config.py_rng.randint(0, 10)
Type:

random.Random()

property seed

Get/set seed for all random number generators

All random number generators used internally by Sionna can be configured with a common seed to ensure reproducability of results. It defaults to None which implies that a random seed will be used and results are non-deterministic.

# This code will lead to deterministic results
import sionna
sionna.config.seed = 42
print(sionna.utils.BinarySource()([10]))
tf.Tensor([0. 1. 1. 1. 1. 0. 1. 0. 1. 0.], shape=(10,), dtype=float32)
Type:

int

property tf_rng

TensorFlow random number generator

import sionna
sionna.config.seed = 42 # Set seed for deterministic results

# Use generator instead of tf.random
noise = sionna.config.tf_rng.normal([4])
Type:

tf.random.Generator

property xla_compat

Ensure that functions execute in an XLA compatible way.

Not all TensorFlow ops support the three execution modes for all dtypes: Eager, Graph, and Graph with XLA. For this reason, some functions are implemented differently depending on the execution mode. As it is currently impossible to programmatically determine if a function is executed in Graph or Graph with XLA mode, the xla_compat property can be used to indicate which execution mode is desired. Note that most functions will work in all execution modes independently of the value of this property.

This property can be used like this:

import sionna
sionna.config.xla_compat=True
@tf.function(jit_compile=True)
def func()
    # Implementation

func()
Type:

bool