@@ -76,7 +76,7 @@ def comma_separated_string_to_integer_list(s):
76
76
77
77
def saturating_sigmoid (x ):
78
78
"""Saturating sigmoid: 1.2 * sigmoid(x) - 0.1 cut to [0, 1]."""
79
- with tf .name_scope ("saturating_sigmoid" , [x ]):
79
+ with tf .name_scope ("saturating_sigmoid" , values = [x ]):
80
80
y = tf .sigmoid (x )
81
81
return tf .minimum (1.0 , tf .maximum (0.0 , 1.2 * y - 0.1 ))
82
82
@@ -173,7 +173,7 @@ def shakeshake(xs, equal_grad=False):
173
173
174
174
def convert_rgb_to_real (x ):
175
175
"""Conversion of pixel values to real numbers."""
176
- with tf .name_scope ("rgb_to_real" , [x ]):
176
+ with tf .name_scope ("rgb_to_real" , values = [x ]):
177
177
x = tf .to_float (x )
178
178
# Use the formula (value/128) - 1 to convert each channel value into a
179
179
# real number in the range -1 to 1.
@@ -794,7 +794,7 @@ def subseparable_conv_block(inputs, filters, dilation_rates_and_kernel_sizes,
794
794
795
795
def pool (inputs , window_size , pooling_type , padding , strides = (1 , 1 )):
796
796
"""Pooling (supports "LEFT")."""
797
- with tf .name_scope ("pool" , [inputs ]):
797
+ with tf .name_scope ("pool" , values = [inputs ]):
798
798
static_shape = inputs .get_shape ()
799
799
if not static_shape or len (static_shape ) != 4 :
800
800
raise ValueError ("Inputs to conv must have statically known rank 4." )
@@ -949,7 +949,7 @@ def simple_attention(target, source, bias=None):
949
949
Returns:
950
950
a `Tensor` with same shape as `target`
951
951
"""
952
- with tf .name_scope ("simple_attention" , [target , source ]):
952
+ with tf .name_scope ("simple_attention" , values = [target , source ]):
953
953
target_shape = shape_list (target )
954
954
source_shape = shape_list (source )
955
955
target = tf .reshape (
@@ -1515,7 +1515,7 @@ def pad_to_same_length(x, y, final_length_divisible_by=1, axis=1):
1515
1515
"""Pad tensors x and y on axis 1 so that they have the same length."""
1516
1516
if axis not in [1 , 2 ]:
1517
1517
raise ValueError ("Only axis=1 and axis=2 supported for now." )
1518
- with tf .name_scope ("pad_to_same_length" , [x , y ]):
1518
+ with tf .name_scope ("pad_to_same_length" , values = [x , y ]):
1519
1519
x_length = shape_list (x )[axis ]
1520
1520
y_length = shape_list (y )[axis ]
1521
1521
max_length = tf .maximum (x_length , y_length )
@@ -1550,7 +1550,7 @@ def padding_list(length_diff, arg):
1550
1550
1551
1551
def pad_with_zeros (logits , labels ):
1552
1552
"""Pad labels on the length dimension to match logits length."""
1553
- with tf .name_scope ("pad_with_zeros" , [logits , labels ]):
1553
+ with tf .name_scope ("pad_with_zeros" , values = [logits , labels ]):
1554
1554
logits , labels = pad_to_same_length (logits , labels )
1555
1555
if len (labels .shape .as_list ()) == 3 : # 2-d labels.
1556
1556
logits , labels = pad_to_same_length (logits , labels , axis = 2 )
@@ -1644,7 +1644,7 @@ def padded_cross_entropy(logits,
1644
1644
reduce_sum = reduce_sum )
1645
1645
confidence = 1.0 - label_smoothing
1646
1646
vocab_size = shape_list (logits )[- 1 ]
1647
- with tf .name_scope ("padded_cross_entropy" , [logits , labels ]):
1647
+ with tf .name_scope ("padded_cross_entropy" , values = [logits , labels ]):
1648
1648
if len (logits .get_shape ().as_list ()) == 2 :
1649
1649
# Deal with the case where we did not insert extra dimensions due to
1650
1650
# TPU issues. No pad-to-same-length happens in this case.
@@ -1678,7 +1678,7 @@ def smoothing_cross_entropy(logits,
1678
1678
Returns:
1679
1679
1680
1680
"""
1681
- with tf .name_scope ("smoothing_cross_entropy" , [logits , labels ]):
1681
+ with tf .name_scope ("smoothing_cross_entropy" , values = [logits , labels ]):
1682
1682
# Low confidence is given to all non-true labels, uniformly.
1683
1683
low_confidence = (1.0 - confidence ) / tf .to_float (vocab_size - 1 )
1684
1684
# Normalizing constant is the best cross-entropy value with soft targets.
@@ -1725,7 +1725,7 @@ def global_pool_1d(inputs, pooling_type="MAX", mask=None):
1725
1725
output: A tensor of dimensions batch_size x input_dims
1726
1726
dimension containing the sequences of transformed vectors.
1727
1727
"""
1728
- with tf .name_scope ("global_pool" , [inputs ]):
1728
+ with tf .name_scope ("global_pool" , values = [inputs ]):
1729
1729
if mask is not None :
1730
1730
mask = tf .expand_dims (mask , axis = 2 )
1731
1731
inputs = tf .multiply (inputs , mask )
@@ -1762,7 +1762,7 @@ def running_global_pool_1d(inputs, pooling_type="MAX"):
1762
1762
dimension containing the running 'totals'.
1763
1763
"""
1764
1764
del pooling_type
1765
- with tf .name_scope ("running_global_pool" , [inputs ]):
1765
+ with tf .name_scope ("running_global_pool" , values = [inputs ]):
1766
1766
scan_fct = tf .maximum
1767
1767
# Permute inputs so seq_length is first.
1768
1768
elems = tf .transpose (inputs , [1 , 0 , 2 ])
@@ -2118,7 +2118,7 @@ def padded_cross_entropy_factored(factored_logits,
2118
2118
a = factored_logits .a
2119
2119
b = factored_logits .b
2120
2120
confidence = 1.0 - label_smoothing
2121
- with tf .name_scope ("padded_cross_entropy_factored" , [a , b , labels ]):
2121
+ with tf .name_scope ("padded_cross_entropy_factored" , values = [a , b , labels ]):
2122
2122
labels_flat = tf .reshape (labels , [- 1 ])
2123
2123
a_flat = tf .reshape (a , [- 1 , shape_list (b )[1 ]])
2124
2124
xent = smoothing_cross_entropy_factored (a_flat , b , labels_flat ,
0 commit comments