A slight change - most important part is specifying the squeeze dimension, otherwise this plays badly with batch sizes of 1. I also added kwargs so that p (dropout probability) can be specified.
class ChannelDropout1d(nn.Module):
    def __init__(self, **kwargs):
        super().__init__()
        self.d = nn.Dropout2d(**kwargs)
    
    def forward(self, x):
        out = x
        out = out.unsqueeze(-1)
        out = self.d(out)
        out = out.squeeze(-1)
        
        return out