Skip to content

Commit

Permalink
allow backward comp
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaskuestner committed Oct 5, 2020
1 parent 6246f26 commit 36b7572
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import random
from Patient.Patient import *
import os
from packaging import version

import argparse

Expand Down Expand Up @@ -57,9 +58,14 @@ def main(args):
except RuntimeError as e:
print(e)
else: # allocate dynamic growth
config = tf.ConfigProto()
config.gpu_options.allow_growth = True
tf.set_session(tf.Session(config=config))
if version.parse(tf.__version__) >= version.parse('2.0'):
config = tf.compat.v1.ConfigProto()
config.gpu_options.allow_growth = True
tf.compat.v1.keras.backend.set_session(tf.compat.v1.Session(config=config))
else:
config = tf.ConfigProto()
config.gpu_options.allow_growth = True
tf.set_session(tf.Session(config=config))


with open(args.config_path, "r") as yaml_file:
Expand Down

0 comments on commit 36b7572

Please sign in to comment.