def upsample_2d(incoming, kernel_size, name='UpSample2D'):
 input_shape = utils.get_incoming_shape(incoming)
 assert (len(input_shape) == 4), 'Incoming Tensor shape must be 4-D'
 kernel = utils.autoformat_kernel_2d(kernel_size)
 with tf.name_scope(name) as scope:
  inference = tf.image.resize_nearest_neighbor(incoming, size=(input_shape[1:3] * tf.constant(kernel[1:3])))
  inference.set_shape((None, (input_shape[1] * kernel[1]), (input_shape[2] * kernel[2]), None))
 inference.scope = scope
 tf.add_to_collection(((tf.GraphKeys.LAYER_TENSOR + '/') + name), inference)
 return inference

def upsample_2d ( incoming , kernel_size , name = 'UpSample2D' ) : input_shape = utils . get_incoming_shape ( incoming ) assert ( len ( input_shape ) == 4 ) , 'Incoming Tensor shape must be 4-D' kernel = utils . autoformat_kernel_2d ( kernel_size ) with tf . name_scope ( name ) as scope : inference = tf . image . resize_nearest_neighbor ( incoming , size = ( input_shape [ 1 : 3 ] * tf . constant ( kernel [ 1 : 3 ] ) ) ) inference . set_shape ( ( None , ( input_shape [ 1 ] * kernel [ 1 ] ) , ( input_shape [ 2 ] * kernel [ 2 ] ) , None ) ) inference . scope = scope tf . add_to_collection ( ( ( tf . GraphKeys . LAYER_TENSOR + '/' ) + name ) , inference ) return inference
upsample 2d .