Exercises
ex-sp-ch28-01
EasyCreate a complex-valued tensor in PyTorch and compute its magnitude,
phase, real, and imaginary parts. Verify z = |z| * exp(j*angle(z)).
ex-sp-ch28-02
EasyImplement CReLU and verify it on a grid of complex numbers. Plot input and output in the complex plane.
ex-sp-ch28-03
EasyConvert a complex signal to a real tensor of shape by stacking real and imaginary parts. Convert back.
ex-sp-ch28-04
EasyCompute the MSE loss between two complex tensors using abs().pow(2).mean().
Verify it matches computing on real/imag parts separately.
ex-sp-ch28-05
EasyCreate a complex parameter with nn.Parameter(torch.randn(..., dtype=torch.cfloat))
and compute gradients through it. Print the gradient dtype.
ex-sp-ch28-06
MediumImplement a ComplexLinear layer using the structured weight matrix approach. Compare output with native complex multiplication.
ex-sp-ch28-07
MediumImplement modReLU with a learnable bias parameter and train it on a simple complex regression task.
ex-sp-ch28-08
MediumBuild a complex-valued CNN with 3 ComplexConv2d layers and CReLU activations. Apply it to a complex-valued 2D signal.
ex-sp-ch28-09
MediumImplement a differentiable AWGN channel and verify that gradients flow through it correctly (the gradient of the noise should be zero).
ex-sp-ch28-10
MediumCompare a real-split MLP (2 channels) vs a complex-structured MLP on learning the mapping for channel estimation. Report MSE and parameter count.
ex-sp-ch28-11
HardImplement a differentiable OFDM forward model including IFFT, cyclic prefix addition, channel convolution, and FFT at receiver.
ex-sp-ch28-12
HardTrain an autoencoder end-to-end through a Rayleigh fading channel. The encoder maps bits to complex symbols and the decoder recovers bits.
ex-sp-ch28-13
HardImplement complex BatchNorm with 2x2 covariance whitening and compare performance to independent real/imag BatchNorm.
ex-sp-ch28-14
ChallengeVerify phase equivariance empirically: apply a complex linear layer to inputs rotated by various phases and check outputs rotate equally.
ex-sp-ch28-15
ChallengeImplement a complex-valued U-Net for OFDM channel estimation on the resource grid. Compare with real-split U-Net.