Converting a tensorflow model into a pytorch model

I have this tensorflow model that I’d like to convert to pytorch. I tried reading the documentation but it’s still a little fuzzy. Could someone help me?

upsampled = tf.image.resize_images(white_lr, tf.shape(label)[1:3])

C0 = 25
D = 5
h = tf.concat([one_hot_label, upsampled], axis=-1)
hs = []
for i in range(D):
    hs.append(h)
    h = tf.contrib.layers.conv2d(h, int(C0*1.5**i), (3,3), stride=2, scope='conv%d'%(i+1))
    h = tf.concat([h, tf.image.resize_images(white_lr,  tf.shape(h)[1:3])], axis=-1)

for i in range(D)[::-1]:
    h = tf.contrib.layers.conv2d_transpose(h, int(C0*1.5**i), (3,3), stride=2, scope='upconv%d'%(i+1))
    h = tf.concat([h, hs[i]], axis=-1)
h = tf.contrib.layers.conv2d(h, C0, (1,1), scope='fc1')
h = tf.contrib.layers.conv2d(h, 3, (1,1), scope='cls', activation_fn=None)

h = h + upsampled

Could you explain the code a bit more? Currently I’m not sure what shapes some values have, so that re-creating the model is a bit tricky.

It seems upsample is an image tensor. I’m not sure, what h should represent as you are concatenating a one-hot encoded tensor with this image.
Could you clarify it?

I’m sure we can reimplement the model, if you could add some comments to the code (in the best case with shape information!).