code: def initialize_by_shape(shape_to_value):
      """Create an initializer with values specified by tensor shape."""
  
      def initialize(shape, dtype, **unused_kwargs):
          shape = tuple(shape)
          if shape not in shape_to_value:
              raise ValueError(
                  "Shape {} not found in shape to value map.".format(
                      shape
                  )
              )
          return tf.reshape(
              tf.constant(shape_to_value[tuple(shape)], dtype=dtype),
              shape,
          )
  
      return initialize
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from absl.testing import parameterized
  import mesh_tensorflow
  from mesh_tensorflow import test_utils
  import mock
  import numpy
  import tensorflow.compat.v1
  import tensorflow_probability
  from tensorflow.python.framework import test_util
label_desc: Use image node_id 1 for calling a global function with example usage: initialize_by_shape(shape_to_value) and returns: initialize, tf