code: def decode_to_shape(inputs, shape, scope):
      """Encode the given tensor to given image shape."""
      with tf.variable_scope(scope, reuse=tf.AUTO_REUSE):
          x = inputs
          x = tfl.flatten(x)
          x = tfl.dense(x, shape[2], activation=None, name="dec_dense")
          x = tf.expand_dims(x, axis=1)
          return x
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import numpy
  from tensor2tensor.layers import common_layers
  from tensor2tensor.utils import contrib
  import tensorflow.compat.v1
  from tensorflow.python.ops import summary_op_util
label_desc: Use image node_id 3 for calling a global function with example usage: decode_to_shape(inputs, shape, scope) and returns: x