Created
December 6, 2019 10:35
-
-
Save BenjaminWegener/1205c1059acb72be75179597349e969b to your computer and use it in GitHub Desktop.
Keras only 2x pixel-shuffle / sub_pixel_conv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def sub_pixel_conv(inputs, height, width, out_channels): #keras version of 2x pixel shuffle | |
x = inputs | |
x = SeparableConv2D(out_channels * 4, kernel_size = 9, depth_multiplier = 1, activation = 'tanh', padding = 'same')(x) | |
x = Reshape((height, width, out_channels, 2, 2))(x) | |
x = Permute((3, 2, 4, 1, 5))(x) | |
x = Reshape((out_channels, height * 2, height * 2))(x) | |
x = Permute((2, 3, 1))(x) | |
return x |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
like tf.depth_to_space