leras.nn : support for tf ver 1
This commit is contained in:
+8
-4
@@ -76,15 +76,19 @@ class nn():
|
|||||||
if first_run:
|
if first_run:
|
||||||
io.log_info("Caching GPU kernels...")
|
io.log_info("Caching GPU kernels...")
|
||||||
|
|
||||||
#import tensorflow as tf
|
import tensorflow
|
||||||
import tensorflow.compat.v1 as tf
|
if tensorflow.VERSION[0] == '2':
|
||||||
|
tf = tensorflow.compat.v1
|
||||||
|
else:
|
||||||
|
tf = tensorflow
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
# Disable tensorflow warnings
|
# Disable tensorflow warnings
|
||||||
tf_logger = logging.getLogger('tensorflow')
|
tf_logger = logging.getLogger('tensorflow')
|
||||||
tf_logger.setLevel(logging.ERROR)
|
tf_logger.setLevel(logging.ERROR)
|
||||||
|
|
||||||
tf.disable_v2_behavior()
|
if tensorflow.VERSION[0] == '2':
|
||||||
|
tf.disable_v2_behavior()
|
||||||
nn.tf = tf
|
nn.tf = tf
|
||||||
|
|
||||||
# Initialize framework
|
# Initialize framework
|
||||||
|
|||||||
Reference in New Issue
Block a user