code: def pretrained_initializer(scope, values):
      weights = get_weights(scope)
  
      if values is None:
          return tf.variables_initializer(weights)
  
      if len(weights) > len(values):  # excluding weights in Optimizer
          weights = weights[: len(values)]
  
      if len(weights) != len(values):
          values = values[: len(weights)]
          warnings.warn(
              "The sizes of symbolic and actual weights do not match. "
              "Never mind if you are trying to load stem layers only."
          )
  
      if scope.dtype == tf.float16:
          ops = [
              weights[0].assign(np.asarray(values[0], dtype=np.float16))
          ]
          for w, v in zip(weights[1:-2], values[1:-2]):
              w.load(np.asarray(v, dtype=np.float16))
          if weights[-1].shape != values[-1].shape:
              ops += [w.initializer for w in weights[-2:]]
          else:
              for w, v in zip(weights[-2:], values[-2:]):
                  w.load(np.asarray(v, dtype=np.float16))
          return ops
  
      ops = [w.assign(v) for (w, v) in zip(weights[:-2], values[:-2])]
      if weights[-1].shape != values[-1].shape:  # for transfer learning
          ops += [w.initializer for w in weights[-2:]]
      else:
          # The logits layer can be either 1x1 conv or fc. In other words,
          # the weight shape is (1, 1, features, classes) for the former,
          # or (features, classes) the latter.
          if weights[-2].shape != values[-2].shape:
              values[-2] = values[-2].reshape(weights[-2].shape)
              warnings.warn(
                  "The weight has been reshaped because 1x1 conv and "
                  "fc layers are interchangeable for a logits layer. "
                  "But, the conversion may affect the precision."
              )
          ops += [
              w.assign(v) for (w, v) in zip(weights[-2:], values[-2:])
          ]
  
      return ops
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import numpy
  import tensorflow
  import warnings
  from contextlib import contextmanager
  from .version_utils import tf_later_than
label_desc: Use image node_id 23 for calling a global function with example usage: pretrained_initializer(scope, values) and returns: ops, tf, ops