Commit 0944cb79 authored by Jaehong Kim's avatar Jaehong Kim Committed by A. Unique TensorFlower
Browse files

Internal change

PiperOrigin-RevId: 443706978
parent 828ed8b2
...@@ -365,15 +365,21 @@ class SpineNetMobile(tf.keras.Model): ...@@ -365,15 +365,21 @@ class SpineNetMobile(tf.keras.Model):
parent_weights = [ parent_weights = [
tf.nn.relu(tf.cast(tf.Variable(1.0, name='block{}_fusion{}'.format( tf.nn.relu(tf.cast(tf.Variable(1.0, name='block{}_fusion{}'.format(
i, j)), dtype=dtype)) for j in range(len(parents))] i, j)), dtype=dtype)) for j in range(len(parents))]
weights_sum = layers.Add()(parent_weights) weights_sum = parent_weights[0]
for adder in parent_weights[1:]:
weights_sum = layers.Add()([weights_sum, adder])
parents = [ parents = [
parents[i] * parent_weights[i] / (weights_sum + 0.0001) parents[i] * parent_weights[i] / (weights_sum + 0.0001)
for i in range(len(parents)) for i in range(len(parents))
] ]
# Fuse all parent nodes then build a new block. # Fuse all parent nodes then build a new block.
x = parents[0]
for adder in parents[1:]:
x = layers.Add()([x, adder])
x = tf_utils.get_activation( x = tf_utils.get_activation(
self._activation, use_keras_layer=True)(layers.Add()(parents)) self._activation, use_keras_layer=True)(x)
x = self._block_group( x = self._block_group(
inputs=x, inputs=x,
in_filters=target_num_filters, in_filters=target_num_filters,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment