def get_test_model_and_data_conv_transpose():
    """Two conv transpose layer which share the same weight."""
    inputs = [ct.TensorType(name="data", shape=(1, 64, 5, 5))]
    torch_input_values = [torch.rand(*i.shape.to_list()) for i in inputs]
    coreml_input_values = {
        i.name: val.detach().numpy() for i, val in zip(inputs, torch_input_values)
    }

    class Model(torch.nn.Module):
        def __init__(self):
            super(Model, self).__init__()
            self.conv_transpose1 = torch.nn.ConvTranspose2d(
                in_channels=64, out_channels=32, kernel_size=2
            )
            self.conv_transpose2 = torch.nn.ConvTranspose2d(
                in_channels=64, out_channels=32, kernel_size=2
            )
            self.conv_transpose1.weight = self.conv_transpose2.weight

        def forward(self, x):
            return self.conv_transpose1(x) + self.conv_transpose2(x)

    return Model().eval(), inputs, torch_input_values, coreml_input_values
Two conv transpose layer which share the same weight.
coremltools/test/optimize/coreml/test_post_training_quantization.py