Thank you smth. I did exactly as you said. The problem is from the helper function for tensor multiplication:
def vec_multiplication(W, b):

    #A = torch.mm(W, b.unsqueeze(2))
    #C = A.unsqueeze(-1)
    A = np.dot(W, np.expand_dims(b, 2)).astype(np.float32)
    C = np.squeeze(A, axis = -1)
    C = torch.from_numpy(C)
    return C

I later called this function to multiply two tensors:
    #Channel output
    `y = vec_multiplication(H, x) + w`

So, in an attempt to fix the bug, I commented the helper function, and instead of calling the helper function, I used the following function:
        y = torch.mm(H, x.unsqueeze(1))
        y = y.squeeze(1) + w

When the code is run, I have the following error:
    y, H = mod.channel(x, N, SNR_dB_min, SNR_dB_max, rho, random_channel='Random_Channel')
  File "/Users/Abdullahi/Desktop/DETNET_INCOMPLETE/signal_modulation.py", line 101, in channel
    y = torch.mm(H, x.unsqueeze(1))
RuntimeError: matrices expected, got 3D, 3D

Thank you.