def is_tfv2():
    """
    Returns whether tensorflow is operating in V2 mode.
    """
    try:
        from tensorflow.python import tf2
        return tf2.enabled()
    except Exception:
        return False

    Returns whether tensorflow is operating in V2 mode.
    
tensorpack/compat/__init__.py