NVlabs / sionna

Sionna: An Open-Source Library for Next-Generation Physical Layer Research
https://nvlabs.github.io/sionna
Other
746 stars 214 forks source link

Issue in generating the frequency responses h_freq which are to be processed by the ApplyOFDMChannel Layer in Sionna Ray Tracing Introduction example #580

Closed Jedrek09 closed 2 weeks ago

Jedrek09 commented 2 weeks ago

After running the code :

# Placeholder for tx signal of shape
# [batch size, num_tx, num_tx_ant, num_ofdm_symbols, fft_size]
x = tf.zeros([h_freq.shape.as_list()[i] for i in [0,3,4,5,6]], tf.complex64)

no = 0.1 # noise variance

# Init channel layer
channel = ApplyOFDMChannel(add_awgn=True)

# Apply channel
y = channel([x, h_freq, no])

# [batch size, num_rx, num_rx_ant, num_ofdm_symbols, fft_size]
print(y.shape)

I get the following error:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
File ~\miniconda3\envs\myenv\Lib\site-packages\keras\src\dtype_policies\__init__.py:102, in get(identifier)
    101 try:
--> 102     return DTypePolicy(backend.standardize_dtype(identifier))
    103 except:

File ~\miniconda3\envs\myenv\Lib\site-packages\keras\src\backend\common\variables.py:506, in standardize_dtype(dtype)
    505 if dtype not in dtypes.ALLOWED_DTYPES:
--> 506     raise ValueError(f"Invalid dtype: {dtype}")
    507 return dtype

ValueError: Invalid dtype: complex64

During handling of the above exception, another exception occurred:

ValueError                                Traceback (most recent call last)
Cell In[19], line 8
      5 no = 0.1 # noise variance
      7 # Init channel layer
----> 8 channel = ApplyOFDMChannel(add_awgn=True)
     10 # Apply channel
     11 y = channel([x, h_freq, no])

File ~\miniconda3\envs\myenv\Lib\site-packages\sionna\channel\apply_ofdm_channel.py:82, in ApplyOFDMChannel.__init__(self, add_awgn, dtype, **kwargs)
     80 def __init__(self, add_awgn=True, dtype=tf.complex64, **kwargs):
---> 82     super().__init__(trainable=False, dtype=dtype, **kwargs)
     84     self._add_awgn = add_awgn

File ~\miniconda3\envs\myenv\Lib\site-packages\keras\src\layers\layer.py:268, in Layer.__init__(self, activity_regularizer, trainable, dtype, autocast, name, **kwargs)
    266 BackendLayer.__init__(self)
    267 self._lock = False
--> 268 Operation.__init__(self, dtype=dtype, name=name)
    269 self.activity_regularizer = regularizers.get(activity_regularizer)
    270 input_dim_arg = kwargs.pop("input_dim", None)

File ~\miniconda3\envs\myenv\Lib\site-packages\keras\src\ops\operation.py:26, in Operation.__init__(self, dtype, name)
     20 if not isinstance(name, str) or "/" in name:
     21     raise ValueError(
     22         "Argument `name` must be a string and "
     23         "cannot contain character `/`. "
     24         f"Received: name={name} (of type {type(name)})"
     25     )
---> 26 self._dtype_policy = dtype_policies.get(dtype)
     27 self.name = name
     28 self._inbound_nodes = []

File ~\miniconda3\envs\myenv\Lib\site-packages\keras\src\dtype_policies\__init__.py:104, in get(identifier)
    102     return DTypePolicy(backend.standardize_dtype(identifier))
    103 except:
--> 104     raise ValueError(
    105         "Cannot interpret `dtype` argument. Expected a string "
    106         f"or an instance of DTypePolicy. Received: dtype={identifier}"
    107     )

ValueError: Cannot interpret `dtype` argument. Expected a string or an instance of DTypePolicy. Received: dtype=<dtype: 'complex64'>
jhoydis commented 2 weeks ago

Hi @Jedrek09,

This is not an issue. You are running Sionna with an incompatible version of TensorFlow.