Hi,
I have figured out the problem. Instead of:
self.constellation_size = self.constellation.shape[0]

I write:
self.constellation_size = self.constellation[:,0].shape

However, another error still appears:
AttributeError                            Traceback (most recent call last)
 in 
33
34         return indices
—> 35 indices = Modulator(‘BPSK’, 10)
 in init(self, mod_type, K)
25         # Normalize constellation to unit power and convert to tensor
26         self.constellation /= torch.sqrt(torch.mean(torch.abs(self.constellation)**2))
—> 27         self.constellation = torch.Variable(self.constellation, requires_grad = False)
28         return
29
AttributeError: module ‘torch’ has no attribute ‘Variable’
But I have actually imported the Variable from torch.autograd