Skip to content
This repository has been archived by the owner on Dec 9, 2024. It is now read-only.

Commit

Permalink
Update references from variables.VariableV1 to its new location in …
Browse files Browse the repository at this point in the history
…`ops/variable_v1.py`.

PiperOrigin-RevId: 520732231
  • Loading branch information
fionalang authored and reedwm committed Sep 19, 2023
1 parent c8e97df commit 559f08f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
10 changes: 6 additions & 4 deletions scripts/tf_cnn_benchmarks/models/experimental/deepspeech.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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(
Expand Down
8 changes: 5 additions & 3 deletions scripts/tf_cnn_benchmarks/models/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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,
Expand Down
10 changes: 6 additions & 4 deletions scripts/tf_cnn_benchmarks/models/tf1_only/ssd_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 559f08f

Please sign in to comment.