def upsample_conv1d(x, num_filters, filter_length, stride, use_resize_conv, name_patt, act='tanh', use_weight_norm=False, init=False): act_func = masked.get_upsample_act(act) conv_args = { "x": x, "num_filters": num_filters, "filter_length": filter_length, "stride": stride, "activation": act_func, "use_weight_norm": use_weight_norm, "init": init } if use_resize_conv: y = masked.resize_conv1d(**conv_args, name=name_patt.format("resize_conv")) else: y = masked.trans_conv1d(**conv_args, name=name_patt.format("trans_conv")) return y
def upsample_conv1d( x, num_filters, filter_length, stride, name_patt, use_weight_norm=False, init=False): conv_args = {"x": x, "num_filters": num_filters, "filter_length": filter_length, "stride": stride, "use_weight_norm": use_weight_norm, "init": init} if USE_RESIZE_CONV: y = masked.resize_conv1d( **conv_args, name=name_patt.format("resize_conv")) else: y = masked.trans_conv1d( **conv_args, name=name_patt.format("trans_conv")) return y
def _deconv_stack(inputs, width, config, name=''): b, l, _ = inputs.get_shape().as_list() frame_shift = int(np.prod([c[1] for c in config])) mel_en = inputs for i in range(len(config)): fl, s = config[i] if name: tc_name = '{}/trans_conv_{:d}'.format(name, i + 1) else: tc_name = 'trans_conv_{:d}'.format(i + 1) mel_en = masked.trans_conv1d(mel_en, num_filters=width, filter_length=fl, stride=s, name=tc_name) mel_en.set_shape([b, l * frame_shift, width]) return mel_en