def convert_convtranspose(params, w_name, scope_name, inputs, layers, weights, names):
print('<STR_LIT>')<EOL>if names == '<STR_LIT>':<EOL><INDENT>tf_name = '<STR_LIT:C>' + random_string(<NUM_LIT:7>)<EOL><DEDENT>elif names == '<STR_LIT>':<EOL><INDENT>tf_name = w_name<EOL><DEDENT>else:<EOL><INDENT>tf_name = w_name + str(random.random())<EOL><DEDENT>bias_name = '<STR_LIT>'.format(w_name)<EOL>weights_name = '<STR_LIT>'.format(w_name)<EOL>if len(weights[weights_name].numpy().shape) == <NUM_LIT:4>:<EOL><INDENT>W = weights[weights_name].numpy().transpose(<NUM_LIT:2>, <NUM_LIT:3>, <NUM_LIT:1>, <NUM_LIT:0>)<EOL>height, width, n_filters, channels = W.shape<EOL>n_groups = params['<STR_LIT>']<EOL>if n_groups > <NUM_LIT:1>:<EOL><INDENT>raise AssertionError('<STR_LIT>')<EOL><DEDENT>if params['<STR_LIT>'][<NUM_LIT:0>] > <NUM_LIT:1>:<EOL><INDENT>raise AssertionError('<STR_LIT>')<EOL><DEDENT>if bias_name in weights:<EOL><INDENT>biases = weights[bias_name].numpy()<EOL>has_bias = True<EOL><DEDENT>else:<EOL><INDENT>biases = None<EOL>has_bias = False<EOL><DEDENT>input_name = inputs[<NUM_LIT:0>]<EOL>if has_bias:<EOL><INDENT>weights = [W, biases]<EOL><DEDENT>else:<EOL><INDENT>weights = [W]<EOL><DEDENT>conv = keras.layers.Conv2DTranspose(<EOL>filters=n_filters,<EOL>kernel_size=(height, width),<EOL>strides=(params['<STR_LIT>'][<NUM_LIT:0>], params['<STR_LIT>'][<NUM_LIT:1>]),<EOL>padding='<STR_LIT>',<EOL>output_padding=<NUM_LIT:0>,<EOL>weights=weights,<EOL>use_bias=has_bias,<EOL>activation=None,<EOL>dilation_rate=params['<STR_LIT>'][<NUM_LIT:0>],<EOL>bias_initializer='<STR_LIT>', kernel_initializer='<STR_LIT>',<EOL>name=tf_name<EOL>)<EOL>layers[scope_name] = conv(layers[input_name])<EOL>layers[scope_name].set_shape(layers[scope_name]._keras_shape)<EOL>pads = params['<STR_LIT>']<EOL>if pads[<NUM_LIT:0>] > <NUM_LIT:0>:<EOL><INDENT>assert(len(pads) == <NUM_LIT:2> or (pads[<NUM_LIT:2>] == pads[<NUM_LIT:0>] and pads[<NUM_LIT:3>] == pads[<NUM_LIT:1>]))<EOL>crop = keras.layers.Cropping2D(<EOL>pads[:<NUM_LIT:2>],<EOL>name=tf_name + '<STR_LIT>'<EOL>)<EOL>layers[scope_name] = crop(layers[scope_name])<EOL><DEDENT><DEDENT>else:<EOL><INDENT>raise AssertionError('<STR_LIT>')<EOL><DEDENT>
Convert transposed convolution layer.

Args:
    params: dictionary with layer parameters
    w_name: name prefix in state_dict
    scope_name: pytorch scope name
    inputs: pytorch node inputs
    layers: dictionary with keras tensors
    weights: pytorch state_dict
    names: use short names for keras layers