def MaybeGuaranteeConstGetter(getter, name, *args, **kwargs):
  global _CONST_GUARANTEE
  if _CONST_GUARANTEE:
    with tf.control_dependencies(None):
      return tf.guarantee_const(
          getter(name, *args, **kwargs), name=name + '/GuaranteeConst')
  else:
    return getter(name, *args, **kwargs)
def GuaranteeConstGetter(next_creator, **kwargs):
  if _CONST_GUARANTEE:
    with tf.control_dependencies(None):
      name = kwargs['var_name'] + '/GuaranteeConst'
      return tf.guarantee_const(next_creator(**kwargs), name=name)
  return next_creator(**kwargs)