def METHOD_NAME(tensor: np.ndarray,
                                        layer: tf.keras.layers.Layer) -> np.ndarray:
    """
    Transpose the weight tensor shape from TensorFlow format to libpymo format
    """
    if isinstance(layer, (tf.keras.layers.Conv2DTranspose, tf.keras.layers.DepthwiseConv2D)):
        # TF Conv2DTranspose shape [kernel_height, kernel_width, out_channels, in_channels] ->
        # libpymo shape            [out_channels, in_channels, kernel_height, kernel_width]
        transposed_tensor = tensor.transpose((2, 3, 0, 1))
    elif isinstance(layer, tf.keras.layers.Conv2D):
        # TF Conv2D shape          [kernel_height, kernel_width, in_channels, out_channels] ->
        # libpymo shape            [out_channels, in_channels, kernel_height, kernel_width]
        transposed_tensor = tensor.transpose((3, 2, 0, 1))
    else:
        raise ValueError("Only Conv2D or it's subclass is currently supported")
    return transposed_tensor