//  [python]
def __init__(self, n_in_channels, cond_in_channels, hparams):
        super(WN, self).__init__()
        assert(hparams.var_wn_kernel_size % 2 == 1), 'kernel_size must be an odd number'
        assert(hparams.var_wn_n_channels % 2 == 0), 'n_channels must be a multiple of 2'
        assert(hparams.var_wn_cond_layers > 0), 'cond_layers must be greater than 0'
        assert hparams.var_wn_res_skip or hparams.var_wn_merge_res_skip, "Cannot remove res_skip without using merge_res_skip"
        self.n_layers = hparams.var_wn_n_layers
        self.n_channels = hparams.var_wn_n_channels
        self.speaker_embed_dim = 0
        self.merge_res_skip = hparams.var_wn_merge_res_skip
        
        self.in_layers = nn.ModuleList()
        
        start = nn.Conv1d(n_in_channels, self.n_channels, 1)# first 1x1 Conv
        start = nn.utils.parametrizations.weight_norm(start, name='weight')
        self.start = start
        
        end = nn.Conv1d(self.n_channels, 2*n_in_channels, 1) # last 1x1 Conv
        end.weight.data.zero_()
        end.weight.data.zero_()
        end.bias.data.zero_()
        self.end = end
        
        self.cond_layers = nn.ModuleList()
        if hparams.var_wn_cond_layers:
            cond_in_channels = cond_in_channels + self.speaker_embed_dim
            cond_pad = int((hparams.var_wn_cond_kernel_size - 1)/2)
            cond_output_channels = 2*self.n_channels*self.n_layers
            # messy initialization for arbitrary number of layers, input dims and output dims
            dimensions = [cond_in_channels,]+[hparams.var_wn_cond_hidden_channels]*(hparams.var_wn_cond_layers-1)+[cond_output_channels,]
            in_dims = dimensions[:-1]
            out_dims = dimensions[1:]
            
            for i in range(len(in_dims)):
                indim = in_dims[i]
                outim = out_dims[i]
                cond_layer = nn.Conv1d(indim, outim, hparams.var_wn_cond_kernel_size, padding=cond_pad, padding_mode=hparams.var_wn_cond_padding_mode)
                cond_layer = nn.utils.parametrizations.weight_norm(cond_layer, name='weight')
                self.cond_layers.append(cond_layer)
            
            hparams.var_wn_cond_act_func = hparams.var_wn_cond_act_func.lower()
            if hparams.var_wn_cond_act_func == 'none':
                pass
            elif hparams.var_wn_cond_act_func == 'lrelu':
                self.wn_cond_act_func = torch.nn.functional.relu
            elif hparams.var_wn_cond_act_func == 'relu':
                assert negative_slope, "negative_slope not defined in wn_config"
                self.wn_cond_act_func = torch.nn.LeakyReLU(negative_slope=0.2, inplace=False)
            elif hparams.var_wn_cond_act_func == 'tanh':
                self.wn_cond_act_func = torch.nn.functional.tanh
            elif hparams.var_wn_cond_act_func == 'sigmoid':
                self.wn_cond_act_func = torch.nn.functional.sigmoid
            else:
                raise NotImplementedError('hparams.var_wn_cond_act_func is invalid')
        
        self.res_skip_layers = nn.ModuleList()
        if type(hparams.var_wn_dilations_w) == int:
            hparams.var_wn_dilations_w = [hparams.var_wn_dilations_w,]*self.n_layers # constant dilation if using int
        for i in range(self.n_layers):
            dilation = 2 ** i if hparams.var_wn_dilations_w is None else hparams.var_wn_dilations_w[i]
            padding = int((hparams.var_wn_kernel_size*dilation - dilation)/2)
            if (not hparams.var_wn_seperable_conv) or (hparams.var_wn_kernel_size == 1):
                in_layer = nn.Conv1d(self.n_channels, 2*self.n_channels, hparams.var_wn_kernel_size, dilation=dilation, padding=padding, padding_mode='zeros')
                in_layer = nn.utils.parametrizations.weight_norm(in_layer, name='weight')
            else:
                depthwise = nn.Conv1d(self.n_channels, self.n_channels, hparams.var_wn_kernel_size, dilation=dilation, padding=padding, padding_mode='zeros', groups=self.n_channels)
                depthwise = nn.utils.parametrizations.weight_norm(depthwise, name='weight')
                pointwise = nn.Conv1d(self.n_channels, 2*self.n_channels, 1,
                                    dilation=dilation, padding=0)
                pointwise = nn.utils.parametrizations.weight_norm(pointwise, name='weight')
                in_layer = torch.nn.Sequential(depthwise, pointwise)
            self.in_layers.append(in_layer)
            
            # last one is not necessary
            if i < self.n_layers - 1 and not self.merge_res_skip:
                res_skip_channels = 2*self.n_channels
            else:
                res_skip_channels = self.n_channels
            
            if hparams.var_wn_res_skip:
                res_skip_layer = nn.Conv1d(self.n_channels, res_skip_channels, 1)
                res_skip_layer = nn.utils.parametrizations.weight_norm(res_skip_layer, name='weight')
                self.res_skip_layers.append(res_skip_layer)