Skip to content

Commit

Permalink
Make TF availability check optional (#305)
Browse files Browse the repository at this point in the history
* Make tf availability check optional

* update changelog
  • Loading branch information
Maxim Zhiltsov authored Jun 20, 2021
1 parent 9eb5246 commit 7d7e075
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- A base class for dataset validation plugins (<https://github.com/openvinotoolkit/datumaro/pull/299>)

### Changed
-
- Tensorflow AVX check is made optional in API and is disabled by default (<https://github.com/openvinotoolkit/datumaro/pull/305>)

### Deprecated
-
Expand Down
7 changes: 6 additions & 1 deletion datumaro/util/tf_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
# SPDX-License-Identifier: MIT


enable_tf_check = False

def check_import():
# Workaround for checking import availability:
# Official TF builds include AVX instructions. Once we try to import,
Expand Down Expand Up @@ -32,7 +34,7 @@ def check_import():

raise ImportError(message)

def import_tf(check=True):
def import_tf(check=None):
import sys

not_found = object()
Expand All @@ -46,6 +48,9 @@ def import_tf(check=True):
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'

if check is None:
check = enable_tf_check

if check:
try:
check_import()
Expand Down

0 comments on commit 7d7e075

Please sign in to comment.