Skip to content

Commit

Permalink
Fix TF deprecation warning.
Browse files Browse the repository at this point in the history
  • Loading branch information
XericZephyr committed Aug 20, 2019
1 parent 1fb20de commit 41f99a3
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions frame_level_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def create_model(self,
max_frames = model_input.get_shape().as_list()[1]
feature_size = model_input.get_shape().as_list()[2]
reshaped_input = tf.reshape(model_input, [-1, feature_size])
tf.summary.histogram("input_hist", reshaped_input)
tf.compat.v1.summary.histogram("input_hist", reshaped_input)

if add_batch_norm:
reshaped_input = slim.batch_norm(
Expand All @@ -156,11 +156,11 @@ def create_model(self,
is_training=is_training,
scope="input_bn")

cluster_weights = tf.get_variable(
cluster_weights = tf.compat.v1.get_variable(
"cluster_weights", [feature_size, cluster_size],
initializer=tf.random_normal_initializer(stddev=1 /
math.sqrt(feature_size)))
tf.summary.histogram("cluster_weights", cluster_weights)
tf.compat.v1.summary.histogram("cluster_weights", cluster_weights)
activation = tf.matmul(reshaped_input, cluster_weights)
if add_batch_norm:
activation = slim.batch_norm(
Expand All @@ -170,23 +170,23 @@ def create_model(self,
is_training=is_training,
scope="cluster_bn")
else:
cluster_biases = tf.get_variable(
cluster_biases = tf.compat.v1.get_variable(
"cluster_biases", [cluster_size],
initializer=tf.random_normal_initializer(stddev=1 /
math.sqrt(feature_size)))
tf.summary.histogram("cluster_biases", cluster_biases)
tf.compat.v1.summary.histogram("cluster_biases", cluster_biases)
activation += cluster_biases
activation = act_fn(activation)
tf.summary.histogram("cluster_output", activation)
tf.compat.v1.summary.histogram("cluster_output", activation)

activation = tf.reshape(activation, [-1, max_frames, cluster_size])
activation = utils.FramePooling(activation, FLAGS.dbof_pooling_method)

hidden1_weights = tf.get_variable(
hidden1_weights = tf.compat.v1.get_variable(
"hidden1_weights", [cluster_size, hidden1_size],
initializer=tf.random_normal_initializer(stddev=1 /
math.sqrt(cluster_size)))
tf.summary.histogram("hidden1_weights", hidden1_weights)
tf.compat.v1.summary.histogram("hidden1_weights", hidden1_weights)
activation = tf.matmul(activation, hidden1_weights)
if add_batch_norm:
activation = slim.batch_norm(
Expand All @@ -196,13 +196,13 @@ def create_model(self,
is_training=is_training,
scope="hidden1_bn")
else:
hidden1_biases = tf.get_variable(
hidden1_biases = tf.compat.v1.get_variable(
"hidden1_biases", [hidden1_size],
initializer=tf.random_normal_initializer(stddev=0.01))
tf.summary.histogram("hidden1_biases", hidden1_biases)
tf.compat.v1.summary.histogram("hidden1_biases", hidden1_biases)
activation += hidden1_biases
activation = act_fn(activation)
tf.summary.histogram("hidden1_output", activation)
tf.compat.v1.summary.histogram("hidden1_output", activation)

aggregated_model = getattr(video_level_models,
FLAGS.video_level_classifier_model)
Expand Down

0 comments on commit 41f99a3

Please sign in to comment.