'An alternative implemenation for the encoding coordinates.
Args:
net: a tensor of shape=[batch_size, height, width, num_features]
Returns:
a list of tensors with encoded image coordinates in them.'

def encode_coordinates_alt(self, net):

    (batch_size, h, w, _) = net.shape.as_list()
    h_loc = [tf.tile(tf.reshape(tf.contrib.layers.one_hot_encoding(tf.constant([i]), num_classes=h), [h, 1]), [1, w]) for i in xrange(h)]
    h_loc = tf.concat([tf.expand_dims(t, 2) for t in h_loc], 2)
    w_loc = [tf.tile(tf.contrib.layers.one_hot_encoding(tf.constant([i]), num_classes=w), [h, 1]) for i in xrange(w)]
    w_loc = tf.concat([tf.expand_dims(t, 2) for t in w_loc], 2)
    loc = tf.concat([h_loc, w_loc], 2)
    loc = tf.tile(tf.expand_dims(loc, 0), [batch_size, 1, 1, 1])
    return tf.concat([net, loc], 3)
