code: def make_diet_var_getter(params):
      """Create a custom variable getter for diet variables according to params."""
  
      def diet_var_initializer(shape, dtype, partition_info=None):
          """Initializer for a diet variable."""
          del dtype
          del partition_info
  
          with common_layers.fn_device_dependency(
              "diet_init"
          ) as out_deps:
              float_range = math.sqrt(3)
              ret = tf.random_uniform(shape, -float_range, float_range)
              if params.quantize:
                  ret = _quantize(ret, params, randomize=False)
              out_deps.append(ret)
              return ret
  
      def diet_var_getter(getter, **kwargs):
          """Get diet variable and return it dequantized."""
          if params.quantize:
              kwargs["dtype"] = tf.float16
          kwargs["initializer"] = diet_var_initializer
          kwargs["trainable"] = False
  
          base_var = getter(**kwargs)
  
          dequantized = _dequantize(base_var, params)
  
          if not hasattr(params, "dequantized"):
              params.dequantized = defaultdict(list)
          params.dequantized[base_var.name].append(dequantized)
  
          return dequantized
  
      return diet_var_getter
  
imports: from collections import defaultdict
  import copy
  import math
  from tensor2tensor.layers import common_layers
  from tensor2tensor.utils import hparam
  import tensorflow.compat.v1
label_desc: Use image node_id 6 for calling a global function with example usage: make_diet_var_getter(params) and returns: diet_var_getter, dequantized, ret