
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import os


_force_enable = False


def enable():
  """Enables v2 behaviors."""
  global _force_enable
  _force_enable = True


def disable():
  """Disables v2 behaviors (TF2_BEHAVIOR env variable is still respected)."""
  global _force_enable
  _force_enable = False


def enabled():
  """Returns True iff TensorFlow 2.0 behavior should be enabled."""
  return _force_enable or os.getenv("TF2_BEHAVIOR") is not None


from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import os


_force_enable = False


def enable():
  """Enables v2 behaviors."""
  global _force_enable
  _force_enable = True


def disable():
  """Disables v2 behaviors (TF2_BEHAVIOR env variable is still respected)."""
  global _force_enable
  _force_enable = False


def enabled():
  """Returns True iff TensorFlow 2.0 behavior should be enabled."""
  return _force_enable or os.getenv("TF2_BEHAVIOR", "0") != "0"

Make TF2_BEHAVIOR=0 disable TF2 behavior.
Make TF2_BEHAVIOR=0 disable TF2 behavior.

Prior to this change, the mere presence of a TF2_BEHAVIOR
environment variable would enable TF2 behavior. With this,
setting that environment variable to "0" will disable it.

PiperOrigin-RevId: 223804383

  
  from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  
  import os
  
  
  _force_enable = False
  
  
  def enable():
    """Enables v2 behaviors."""
    global _force_enable
    _force_enable = True
  
  
  def disable():
    """Disables v2 behaviors (TF2_BEHAVIOR env variable is still respected)."""
    global _force_enable
    _force_enable = False
  
  
  def enabled():
    """Returns True iff TensorFlow 2.0 behavior should be enabled."""
-   return _force_enable or os.getenv("TF2_BEHAVIOR") is not None
+   return _force_enable or os.getenv("TF2_BEHAVIOR", "0") != "0"
  
Make TF2_BEHAVIOR=0 disable TF2 behavior.
## Code Before:

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import os


_force_enable = False


def enable():
  """Enables v2 behaviors."""
  global _force_enable
  _force_enable = True


def disable():
  """Disables v2 behaviors (TF2_BEHAVIOR env variable is still respected)."""
  global _force_enable
  _force_enable = False


def enabled():
  """Returns True iff TensorFlow 2.0 behavior should be enabled."""
  return _force_enable or os.getenv("TF2_BEHAVIOR") is not None

## Instruction:
Make TF2_BEHAVIOR=0 disable TF2 behavior.
## Code After:

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import os


_force_enable = False


def enable():
  """Enables v2 behaviors."""
  global _force_enable
  _force_enable = True


def disable():
  """Disables v2 behaviors (TF2_BEHAVIOR env variable is still respected)."""
  global _force_enable
  _force_enable = False


def enabled():
  """Returns True iff TensorFlow 2.0 behavior should be enabled."""
  return _force_enable or os.getenv("TF2_BEHAVIOR", "0") != "0"
