Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/tensorflow/python/tf2.py: 70%

10 statements  

« prev     ^ index     » next       coverage.py v7.3.2, created at 2023-10-05 06:32 +0000

1# Copyright 2018 The TensorFlow Authors. All Rights Reserved. 

2# 

3# Licensed under the Apache License, Version 2.0 (the "License"); 

4# you may not use this file except in compliance with the License. 

5# You may obtain a copy of the License at 

6# 

7# http://www.apache.org/licenses/LICENSE-2.0 

8# 

9# Unless required by applicable law or agreed to in writing, software 

10# distributed under the License is distributed on an "AS IS" BASIS, 

11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 

12# See the License for the specific language governing permissions and 

13# limitations under the License. 

14# ============================================================================== 

15"""Tools to help with the TensorFlow 2.0 transition. 

16 

17This module is meant for TensorFlow internal implementation, not for users of 

18the TensorFlow library. For that see tf.compat instead. 

19""" 

20 

21from tensorflow.python.platform import _pywrap_tf2 

22from tensorflow.python.util.tf_export import tf_export 

23 

24 

25def enable(): 

26 # Enables v2 behaviors. 

27 _pywrap_tf2.enable(True) 

28 

29 

30def disable(): 

31 # Disables v2 behaviors. 

32 _pywrap_tf2.enable(False) 

33 

34 

35@tf_export("__internal__.tf2.enabled", v1=[]) 

36def enabled(): 

37 # Returns True iff TensorFlow 2.0 behavior should be enabled. 

38 return _pywrap_tf2.is_enabled()