Skip to content

Commit 2160fc7

Browse files
Augustin-Zidekdiegolascasas
authored andcommitted
Update requirements versions, change tf.compat.v1. usages to tf.
PiperOrigin-RevId: 288659456
1 parent a506a42 commit 2160fc7

7 files changed

+24
-23
lines changed

alphafold_casp13/contacts.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ def evaluate(crop_size_x, crop_size_y, feature_normalization, checkpoint_path,
7171
normalization_exclusion=normalization_exclusion)
7272

7373
checkpoint = snt.get_saver(experiment.model, collections=[
74-
tf.compat.v1.GraphKeys.GLOBAL_VARIABLES,
75-
tf.compat.v1.GraphKeys.MOVING_AVERAGE_VARIABLES])
74+
tf.GraphKeys.GLOBAL_VARIABLES,
75+
tf.GraphKeys.MOVING_AVERAGE_VARIABLES])
7676

77-
with tf.compat.v1.train.SingularMonitoredSession(hooks=[]) as sess:
77+
with tf.train.SingularMonitoredSession(hooks=[]) as sess:
7878
logging.info('Restoring from checkpoint %s', checkpoint_path)
7979
checkpoint.restore(sess, checkpoint_path)
8080

alphafold_casp13/contacts_dataset.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ def parse_tfexample(raw_data, features):
167167
for k, v in parsed_features.items():
168168
new_shape = shape(feature_name=k, num_residues=num_residues)
169169
# Make sure the feature we are reshaping is not empty.
170-
assert_non_empty = tf.compat.v1.assert_greater(
170+
assert_non_empty = tf.assert_greater(
171171
tf.size(v), 0, name='assert_%s_non_empty' % k,
172172
message='The feature %s is not set in the tf.Example. Either do not '
173173
'request the feature or use a tf.Example that has the feature set.' % k)
@@ -245,7 +245,7 @@ def normalize_from_stats_file(
245245
train_mean = tf.cast(norm_stats['mean'][key], dtype=tf.float32)
246246
train_range = tf.sqrt(tf.cast(norm_stats['var'][key], dtype=tf.float32))
247247
value -= train_mean
248-
value = tf.compat.v1.where(
248+
value = tf.where(
249249
train_range > range_epsilon, value / train_range, value)
250250
features[key] = value
251251
else:

alphafold_casp13/contacts_experiment.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@
2222

2323

2424
def _int_ph(shape, name):
25-
return tf.compat.v1.placeholder(
25+
return tf.placeholder(
2626
dtype=tf.int32, shape=shape, name=('%s_placeholder' % name))
2727

2828

2929
def _float_ph(shape, name):
30-
return tf.compat.v1.placeholder(
30+
return tf.placeholder(
3131
dtype=tf.float32, shape=shape, name=('%s_placeholder' % name))
3232

3333

@@ -102,7 +102,7 @@ def convert_to_legacy(features):
102102
dataset = dataset.batch(1)
103103

104104
# Get a batch of tensors in the legacy ProteinsDataset format.
105-
iterator = tf.compat.v1.data.make_one_shot_iterator(dataset)
105+
iterator = tf.data.make_one_shot_iterator(dataset)
106106
self._input_batch = iterator.get_next()
107107

108108
self.num_eval_examples = sum(

alphafold_casp13/contacts_network.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def call_on_tuple(f):
4141

4242

4343
class ContactsNet(sonnet.AbstractModule):
44-
"""A network to go from sequence to secondary structure."""
44+
"""A network to go from sequence to distance histograms."""
4545

4646
def __init__(self,
4747
binary_code_bits,
@@ -102,7 +102,7 @@ def __init__(self,
102102
if self.asa_multiplier > 0:
103103
self._asa = asa_output.ASAOutputLayer()
104104
if self._position_specific_bias_size:
105-
self._position_specific_bias = tf.compat.v1.get_variable(
105+
self._position_specific_bias = tf.get_variable(
106106
'position_specific_bias',
107107
[self._position_specific_bias_size, self._num_bins or 1],
108108
initializer=tf.zeros_initializer())
@@ -338,7 +338,7 @@ def _build_2d_embedding(self, hidden_1d, residue_index, inputs_2d,
338338
layers_forward = None
339339
if config_2d_deep.extra_blocks:
340340
# Optionally put some extra double-size blocks at the beginning.
341-
with tf.compat.v1.variable_scope('Deep2DExtra'):
341+
with tf.variable_scope('Deep2DExtra'):
342342
hidden_2d = two_dim_resnet.make_two_dim_resnet(
343343
input_node=hidden_2d,
344344
num_residues=None, # Unused
@@ -362,7 +362,7 @@ def _build_2d_embedding(self, hidden_1d, residue_index, inputs_2d,
362362
if features_forward is not None:
363363
hidden_2d = tf.concat([hidden_2d, features_forward], 1
364364
if data_format == 'NCHW' else 3)
365-
with tf.compat.v1.variable_scope('Deep2D'):
365+
with tf.variable_scope('Deep2D'):
366366
logging.info('2d hidden shape is %s', str(hidden_2d.shape.as_list()))
367367
contact_pre_logits = two_dim_resnet.make_two_dim_resnet(
368368
input_node=hidden_2d,

alphafold_casp13/requirements.txt

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
absl-py>=0.8.0
2-
numpy>=1.16
3-
six>=1.12
4-
dm-sonnet>=1.35
1+
setuptools==41.0.0
2+
absl-py==0.8.1
3+
numpy==1.16
4+
six==1.12
5+
dm-sonnet==1.35
56
tensorflow==1.14
67
tensorflow-probability==0.7.0

alphafold_casp13/secstruct.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def __init__(self, name='secstruct'):
5555

5656
def make_layer_new(self, activations):
5757
"""Make the layer."""
58-
with tf.compat.v1.variable_scope(self.name, reuse=tf.AUTO_REUSE):
58+
with tf.variable_scope(self.name, reuse=tf.AUTO_REUSE):
5959
logging.info('Creating secstruct %s', activations)
6060
self.logits = contrib_layers.linear(activations, self._dimension)
6161
self.ss_q8_probs = tf.nn.softmax(self.logits)

alphafold_casp13/two_dim_convnet.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@
2222
def weight_variable(shape, stddev=0.01):
2323
"""Returns the weight variable."""
2424
logging.vlog(1, 'weight init for shape %s', str(shape))
25-
return tf.compat.v1.get_variable(
25+
return tf.get_variable(
2626
'w', shape, initializer=tf.random_normal_initializer(stddev=stddev))
2727

2828

2929
def bias_variable(shape):
30-
return tf.compat.v1.get_variable(
30+
return tf.get_variable(
3131
'b', shape, initializer=tf.zeros_initializer())
3232

3333

@@ -61,12 +61,12 @@ def make_conv_sep2d_layer(input_node,
6161
filter_size_2 = filter_size
6262
logging.vlog(1, 'layer %s in %d out %d chan mult %d', layer_name, in_channels,
6363
out_channels, channel_multiplier)
64-
with tf.compat.v1.variable_scope(layer_name):
65-
with tf.compat.v1.variable_scope('depthwise'):
64+
with tf.variable_scope(layer_name):
65+
with tf.variable_scope('depthwise'):
6666
w_depthwise = weight_variable(
6767
[filter_size, filter_size_2, in_channels, channel_multiplier],
6868
stddev=stddev)
69-
with tf.compat.v1.variable_scope('pointwise'):
69+
with tf.variable_scope('pointwise'):
7070
w_pointwise = weight_variable(
7171
[1, 1, in_channels * channel_multiplier, out_channels], stddev=stddev)
7272
h_conv = tf.nn.separable_conv2d(
@@ -119,7 +119,7 @@ def make_conv_layer(input_node,
119119
filter_size_2 = filter_size
120120
logging.vlog(
121121
1, 'layer %s in %d out %d', layer_name, in_channels, out_channels)
122-
with tf.compat.v1.variable_scope(layer_name):
122+
with tf.variable_scope(layer_name):
123123
w_conv = weight_variable(
124124
[filter_size, filter_size_2, in_channels, out_channels], stddev=stddev)
125125
h_conv = conv2d(

0 commit comments

Comments
 (0)