Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mapping: allow demapping infinite/high SNR symbols #327

Merged
merged 1 commit into from
Apr 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions sionna/mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -980,6 +980,8 @@ def __init__(self,
dtype.real_dtype,
**kwargs)

self._no_threshold = tf.cast(np.finfo(dtype.as_numpy_dtype).tiny, dtype.real_dtype)

@property
def constellation(self):
return self._constellation
Expand All @@ -1001,6 +1003,8 @@ def call(self, inputs):
# Add a dummy dimension for broadcasting. This is not needed when no
# is a scalar, but also does not do any harm.
no = tf.expand_dims(no, axis=-1)
# Deal with zero or very small values.
no = tf.math.maximum(no, self._no_threshold)

# Compute exponents
exponents = -squared_dist/no
Expand Down
Loading