Replace direct TF app import with absl::app.

(1) TF::app is deprecated
(2) direct TF import is discouraged.

PiperOrigin-RevId: 360918794
Change-Id: Ib750eab99f75a030eb1fff22b44b75b9a75ad7e1
This commit is contained in:
Yanhua Sun 2021-03-04 08:09:42 -08:00 committed by TensorFlower Gardener
parent 18bbdb4952
commit 1a61eebcc7
16 changed files with 24 additions and 16 deletions

View File

@ -15,7 +15,6 @@ py_strict_binary(
"//tensorflow/python:constant_op",
"//tensorflow/python:control_flow_ops",
"//tensorflow/python:dtypes",
"//tensorflow/python:platform",
"//tensorflow/python:resource_variable_ops",
"//tensorflow/python:tensor_spec",
"//tensorflow/python:variables",
@ -23,6 +22,7 @@ py_strict_binary(
"//tensorflow/python/eager:def_function",
"//tensorflow/python/module",
"//tensorflow/python/saved_model",
"@absl_py//absl:app",
],
)

View File

@ -26,6 +26,7 @@ from __future__ import google_type_annotations
from __future__ import print_function
import os
from absl import app
from tensorflow.python.compat import v2_compat
@ -37,7 +38,6 @@ from tensorflow.python.module import module
from tensorflow.python.ops import control_flow_ops
from tensorflow.python.ops import resource_variable_ops
from tensorflow.python.ops import variables
from tensorflow.python.platform import app
from tensorflow.python.saved_model import saved_model

View File

@ -83,6 +83,7 @@ py_binary(
"//tensorflow/python:session",
"//tensorflow/python:training",
"//tensorflow/python:variables",
"@absl_py//absl:app",
"@six_archive//:six",
],
)

View File

@ -23,6 +23,7 @@ import argparse
import os
import sys
from absl import app
import six
from six.moves import range
@ -39,7 +40,6 @@ from tensorflow.python.ops import control_flow_util
from tensorflow.python.ops import math_ops
from tensorflow.python.ops import nn_ops
from tensorflow.python.ops import variables
from tensorflow.python.platform import app
from tensorflow.python.training import saver as saver_lib
FLAGS = None

View File

@ -65,6 +65,7 @@ py_binary(
deps = [
":tflite_convert_main_lib",
"//tensorflow:tensorflow_py",
"@absl_py//absl:app",
"@six_archive//:six",
],
)
@ -77,6 +78,7 @@ py_library(
deps = [
":tflite_convert_lib",
"//tensorflow:tensorflow_py",
"@absl_py//absl:app",
"@six_archive//:six",
],
)
@ -91,6 +93,7 @@ py_library(
"//tensorflow/lite/toco/logging:gen_html",
"//tensorflow/lite/toco/logging:toco_conversion_log_proto_py",
"//tensorflow/python:util",
"@absl_py//absl:app",
"@six_archive//:six",
],
)

View File

@ -24,9 +24,9 @@ import os
import sys
import warnings
from absl import app
import six
from six.moves import zip
# Needed to enable TF2 by default.
import tensorflow as tf # pylint: disable=unused-import
from tensorflow.lite.python import lite
@ -35,9 +35,10 @@ from tensorflow.lite.toco import toco_flags_pb2 as _toco_flags_pb2
from tensorflow.lite.toco.logging import gen_html
from tensorflow.python import tf2
from tensorflow.python.framework import dtypes
from tensorflow.python.platform import app
from tensorflow.python.util import keras_deps
# Needed to enable TF2 by default.
def _parse_array(values, type_fn=str):
if values is not None:

View File

@ -95,6 +95,7 @@ py_binary(
"//tensorflow/python:_pywrap_toco_api",
"//tensorflow/python:platform",
"//tensorflow/python:pywrap_tensorflow",
"@absl_py//absl:app",
],
)

View File

@ -24,7 +24,7 @@ import sys
# pylint: disable=invalid-import-order,g-bad-import-order
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
from tensorflow.python import _pywrap_toco_api
from tensorflow.python.platform import app
from absl import app
FLAGS = None

View File

@ -20,11 +20,11 @@ from __future__ import print_function
import argparse
import sys
# Google-internal import(s).
from absl import app
# Google-internal import(s).
from tensorflow.python.debug.cli import analyzer_cli
from tensorflow.python.debug.lib import debug_data
from tensorflow.python.platform import app
def main(_):

View File

@ -35,9 +35,10 @@ from __future__ import print_function
import argparse
import sys
from absl import app
from tensorflow.core.protobuf import config_pb2
from tensorflow.core.protobuf import tensorflow_server_pb2
from tensorflow.python.platform import app
from tensorflow.python.platform import tf_logging as logging
from tensorflow.python.training import server_lib

View File

@ -21,6 +21,7 @@ from __future__ import print_function
import sys
import time
from absl import app
import numpy as np
from tensorflow.core.protobuf import config_pb2
@ -35,7 +36,6 @@ from tensorflow.python.ops import array_ops
from tensorflow.python.ops import control_flow_ops
from tensorflow.python.ops import math_ops
from tensorflow.python.ops import sparse_ops
from tensorflow.python.platform import app
from tensorflow.python.platform import test

View File

@ -21,6 +21,7 @@ from __future__ import print_function
import sys
import time
from absl import app
import numpy as np
from tensorflow.core.protobuf import config_pb2
@ -40,7 +41,6 @@ from tensorflow.python.ops import math_ops
from tensorflow.python.ops import nn_ops
from tensorflow.python.ops import sparse_ops
import tensorflow.python.ops.nn_grad # pylint: disable=unused-import
from tensorflow.python.platform import app
from tensorflow.python.platform import test

View File

@ -24,12 +24,12 @@ To update renames_v2.py, run:
# pylint: enable=line-too-long
import sys
from absl import app
import six
import tensorflow as tf
from tensorflow import python as tf_python # pylint: disable=unused-import
from tensorflow.python.lib.io import file_io
from tensorflow.python.platform import app
from tensorflow.python.util import tf_decorator
from tensorflow.python.util import tf_export
from tensorflow.tools.common import public_api

View File

@ -21,12 +21,11 @@ To update reorders_v2.py, run:
"""
# pylint: enable=line-too-long
from absl import app
import tensorflow as tf
# This import is needed so that TensorFlow python modules are in sys.modules.
from tensorflow import python as tf_python # pylint: disable=unused-import
from tensorflow.python.lib.io import file_io
from tensorflow.python.platform import app
from tensorflow.python.util import tf_decorator
from tensorflow.python.util import tf_export
from tensorflow.python.util import tf_inspect
@ -34,6 +33,8 @@ from tensorflow.tools.common import public_api
from tensorflow.tools.common import traverse
from tensorflow.tools.compatibility import tf_upgrade_v2
# This import is needed so that TensorFlow python modules are in sys.modules.
_OUTPUT_FILE_PATH = 'third_party/tensorflow/tools/compatibility/reorders_v2.py'
_FILE_HEADER = """# Copyright 2018 The TensorFlow Authors. All Rights Reserved.

View File

@ -25,12 +25,12 @@ import shlex
import sys
import time
from absl import app
import six
from google.protobuf import json_format
from google.protobuf import text_format
from tensorflow.core.util import test_log_pb2
from tensorflow.python.platform import app
from tensorflow.python.platform import gfile
from tensorflow.python.platform import test
from tensorflow.python.platform import tf_logging

View File

@ -18,7 +18,7 @@ from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.platform import app
from absl import app
from tensorflow.tools.test import system_info_lib