Unverified Commit a56d7ab3 authored by Leandro Schelb's avatar Leandro Schelb Committed by GitHub
Browse files

Fixed deprecated tf.flags (#9912)

parent 2b68aa95
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
import logging import logging
import sys import sys
from tensorflow.python.platform import flags from tensorflow.compat.v1 import flags
import datasets import datasets
import model import model
......
...@@ -22,8 +22,9 @@ from tensorflow.contrib import slim ...@@ -22,8 +22,9 @@ from tensorflow.contrib import slim
from datasets import fsns from datasets import fsns
from datasets import unittest_utils from datasets import unittest_utils
from tensorflow.compat.v1 import flags
FLAGS = tf.flags.FLAGS FLAGS = flags.FLAGS
def get_test_split(): def get_test_split():
......
...@@ -19,7 +19,7 @@ import numpy as np ...@@ -19,7 +19,7 @@ import numpy as np
import PIL.Image import PIL.Image
import tensorflow as tf import tensorflow as tf
from tensorflow.python.platform import flags from tensorflow.compat.v1 import flags
from tensorflow.python.training import monitored_session from tensorflow.python.training import monitored_session
import common_flags import common_flags
......
...@@ -4,6 +4,7 @@ import os ...@@ -4,6 +4,7 @@ import os
import demo_inference import demo_inference
import tensorflow as tf import tensorflow as tf
from tensorflow.python.training import monitored_session from tensorflow.python.training import monitored_session
from tensorflow.compat.v1 import flags
_CHECKPOINT = 'model.ckpt-399731' _CHECKPOINT = 'model.ckpt-399731'
_CHECKPOINT_URL = 'http://download.tensorflow.org/models/attention_ocr_2017_08_09.tar.gz' _CHECKPOINT_URL = 'http://download.tensorflow.org/models/attention_ocr_2017_08_09.tar.gz'
...@@ -19,7 +20,7 @@ class DemoInferenceTest(tf.test.TestCase): ...@@ -19,7 +20,7 @@ class DemoInferenceTest(tf.test.TestCase):
'Please download and extract it from %s' % 'Please download and extract it from %s' %
(filename, _CHECKPOINT_URL)) (filename, _CHECKPOINT_URL))
self._batch_size = 32 self._batch_size = 32
tf.flags.FLAGS.dataset_dir = os.path.join( flags.FLAGS.dataset_dir = os.path.join(
os.path.dirname(__file__), 'datasets/testdata/fsns') os.path.dirname(__file__), 'datasets/testdata/fsns')
def test_moving_variables_properly_loaded_from_a_checkpoint(self): def test_moving_variables_properly_loaded_from_a_checkpoint(self):
......
...@@ -21,7 +21,7 @@ python eval.py ...@@ -21,7 +21,7 @@ python eval.py
import tensorflow as tf import tensorflow as tf
from tensorflow.contrib import slim from tensorflow.contrib import slim
from tensorflow import app from tensorflow import app
from tensorflow.python.platform import flags from tensorflow.compat.v1 import flags
import data_provider import data_provider
import common_flags import common_flags
......
...@@ -25,7 +25,7 @@ import os ...@@ -25,7 +25,7 @@ import os
import tensorflow as tf import tensorflow as tf
from tensorflow import app from tensorflow import app
from tensorflow.contrib import slim from tensorflow.contrib import slim
from tensorflow.python.platform import flags from tensorflow.compat.v1 import flags
import common_flags import common_flags
import model_export_lib import model_export_lib
......
...@@ -19,6 +19,7 @@ import os ...@@ -19,6 +19,7 @@ import os
import numpy as np import numpy as np
from absl.testing import flagsaver from absl.testing import flagsaver
import tensorflow as tf import tensorflow as tf
from tensorflow.compat.v1 import flags
import common_flags import common_flags
import model_export import model_export
...@@ -51,9 +52,9 @@ class AttentionOcrExportTest(tf.test.TestCase): ...@@ -51,9 +52,9 @@ class AttentionOcrExportTest(tf.test.TestCase):
msg='Missing checkpoint file %s. ' msg='Missing checkpoint file %s. '
'Please download and extract it from %s' % 'Please download and extract it from %s' %
(filename, _CHECKPOINT_URL)) (filename, _CHECKPOINT_URL))
tf.flags.FLAGS.dataset_name = 'fsns' flags.FLAGS.dataset_name = 'fsns'
tf.flags.FLAGS.checkpoint = _CHECKPOINT flags.FLAGS.checkpoint = _CHECKPOINT
tf.flags.FLAGS.dataset_dir = os.path.join( flags.FLAGS.dataset_dir = os.path.join(
os.path.dirname(__file__), 'datasets/testdata/fsns') os.path.dirname(__file__), 'datasets/testdata/fsns')
tf.test.TestCase.setUp(self) tf.test.TestCase.setUp(self)
_clean_up() _clean_up()
......
...@@ -23,7 +23,7 @@ import logging ...@@ -23,7 +23,7 @@ import logging
import tensorflow as tf import tensorflow as tf
from tensorflow.contrib import slim from tensorflow.contrib import slim
from tensorflow import app from tensorflow import app
from tensorflow.python.platform import flags from tensorflow.compat.v1 import flags
from tensorflow.contrib.tfprof import model_analyzer from tensorflow.contrib.tfprof import model_analyzer
import data_provider import data_provider
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment