From 559f08f2cc76c9dbd30f25abc66acc516d1b4bd0 Mon Sep 17 00:00:00 2001 From: Fiona Lang Date: Thu, 30 Mar 2023 13:45:23 -0700 Subject: [PATCH] Update references from `variables.VariableV1` to its new location in `ops/variable_v1.py`. PiperOrigin-RevId: 520732231 --- .../models/experimental/deepspeech.py | 10 ++++++---- scripts/tf_cnn_benchmarks/models/model.py | 8 +++++--- scripts/tf_cnn_benchmarks/models/tf1_only/ssd_model.py | 10 ++++++---- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/scripts/tf_cnn_benchmarks/models/experimental/deepspeech.py b/scripts/tf_cnn_benchmarks/models/experimental/deepspeech.py index 765375d9..7b18f8da 100644 --- a/scripts/tf_cnn_benchmarks/models/experimental/deepspeech.py +++ b/scripts/tf_cnn_benchmarks/models/experimental/deepspeech.py @@ -26,7 +26,7 @@ import constants from cnn_util import log_fn from models import model as model_lib -from tensorflow.python.ops import variables # pylint: disable=g-direct-tensorflow-import +from tensorflow.python.ops import variable_v1 # pylint: disable=g-direct-tensorflow-import class DeepSpeechDecoder(object): @@ -287,9 +287,11 @@ def get_input_shapes(self, subset): def get_synthetic_inputs(self, input_name, nclass): inputs = tf.random_uniform(self.get_input_shapes('train')[0], dtype=self.get_input_data_types('train')[0]) - inputs = variables.VariableV1(inputs, trainable=False, - collections=[tf.GraphKeys.LOCAL_VARIABLES], - name=input_name) + inputs = variable_v1.VariableV1( + inputs, + trainable=False, + collections=[tf.GraphKeys.LOCAL_VARIABLES], + name=input_name) labels = tf.convert_to_tensor( np.random.randint(28, size=[self.batch_size, self.max_label_length])) input_lengths = tf.convert_to_tensor( diff --git a/scripts/tf_cnn_benchmarks/models/model.py b/scripts/tf_cnn_benchmarks/models/model.py index 0c6e4490..85c63b3c 100644 --- a/scripts/tf_cnn_benchmarks/models/model.py +++ b/scripts/tf_cnn_benchmarks/models/model.py @@ -20,7 +20,7 @@ import convnet_builder import mlperf -from tensorflow.python.ops import variables as variables_module # pylint: disable=g-direct-tensorflow-import +from tensorflow.python.ops import variable_v1 # pylint: disable=g-direct-tensorflow-import # BuildNetworkResult encapsulate the result (e.g. logits) of a # Model.build_network() call. @@ -245,8 +245,10 @@ def get_synthetic_inputs(self, input_name, nclass): mean=127, stddev=60, name=self.model_name + '_synthetic_inputs') - inputs = variables_module.VariableV1( - inputs, trainable=False, collections=[tf.GraphKeys.LOCAL_VARIABLES], + inputs = variable_v1.VariableV1( + inputs, + trainable=False, + collections=[tf.GraphKeys.LOCAL_VARIABLES], name=input_name) labels = tf.random_uniform( label_shape, diff --git a/scripts/tf_cnn_benchmarks/models/tf1_only/ssd_model.py b/scripts/tf_cnn_benchmarks/models/tf1_only/ssd_model.py index ec6bb16b..c7ae8ddb 100644 --- a/scripts/tf_cnn_benchmarks/models/tf1_only/ssd_model.py +++ b/scripts/tf_cnn_benchmarks/models/tf1_only/ssd_model.py @@ -41,7 +41,7 @@ from models import model as model_lib from models import resnet_model from tensorflow.contrib import layers as contrib_layers -from tensorflow.python.ops import variables +from tensorflow.python.ops import variable_v1 BACKBONE_MODEL_SCOPE_NAME = 'resnet34_backbone' @@ -663,9 +663,11 @@ def get_synthetic_inputs(self, input_name, nclass): """Generating synthetic data matching real data shape and type.""" inputs = tf.random_uniform( self.get_input_shapes('train')[0], dtype=self.data_type) - inputs = variables.VariableV1(inputs, trainable=False, - collections=[tf.GraphKeys.LOCAL_VARIABLES], - name=input_name) + inputs = variable_v1.VariableV1( + inputs, + trainable=False, + collections=[tf.GraphKeys.LOCAL_VARIABLES], + name=input_name) boxes = tf.random_uniform( [self.batch_size, ssd_constants.NUM_SSD_BOXES, 4], dtype=tf.float32) classes = tf.random_uniform(