Example #1
0
 def _residual(self, h, channels, strides, keep_prob, is_train):
     h0 = h
     h1 = F.conv(F.activation(F.batch_norm(self, 'bn1', h0, is_train)), channels, strides)
     h1 = F.dropout(h1, keep_prob, is_train)
     h2 = F.conv(F.activation(F.batch_norm(self, 'bn2', h1, is_train)), channels)
     if F.volume(h0) == F.volume(h2):
         h = h0 + h2
     else :
         h4 = F.conv(h0, channels, strides)
         h = h2 + h4
     return h
Example #2
0
 def _residual(self, h, channels, strides, keep_prob, is_train):
     h0 = h
     with tf.variable_scope('residual_first'):
         h1 = F.conv(F.activation(F.batch_norm(h0, is_train)), channels, strides)
         h1 = F.dropout(h1, keep_prob, is_train)
     with tf.variable_scope('residual_second'):
         h2 = F.conv(F.activation(F.batch_norm(h1, is_train)), channels)
     if F.volume(h0) == F.volume(h2):
         h = h0 + h2
     else :
         h4 = F.conv(h0, channels, strides)
         h = h2 + h4
     return h
Example #3
0
 def _residual(self, h, channels, strides, keep_prob):
     h0 = h
     h1 = F.dropout(
         F.conv(F.activation(F.batch_normalization(h0)), channels, strides),
         keep_prob)
     h2 = F.conv(F.activation(F.batch_normalization(h1)), channels)
     # c.f. http://gitxiv.com/comments/7rffyqcPLirEEsmpX
     if F.volume(h0) == F.volume(h2):
         h = h2 + h0
     else:
         h4 = F.conv(h0, channels, strides)
         h = h2 + h4
     return h
Example #4
0
 def _residual(self, h, channels, strides):
     h0 = h
     h1 = F.activation(
         F.batch_normalization(
             F.conv(h0, channels, strides, bias_term=False)))
     h2 = F.batch_normalization(F.conv(h1, channels, bias_term=False))
     if F.volume(h0) == F.volume(h2):
         h = h2 + h0
     else:
         h3 = F.avg_pool(h0)
         h4 = tf.pad(h3,
                     [[0, 0], [0, 0], [0, 0], [channels / 4, channels / 4]])
         h = h2 + h4
     return h
Example #5
0
 def _residual(self, h, channels, strides):
     h0 = h
     h1 = F.activation(
         F.batch_normalization(
             F.conv(h0, channels, strides, bias_term=False)))
     h2 = F.batch_normalization(F.conv(h1, channels, bias_term=False))
     # c.f. http://gitxiv.com/comments/7rffyqcPLirEEsmpX
     if F.volume(h0) == F.volume(h2):
         h = h2 + h0
     else:
         h3 = F.avg_pool(h0)
         h4 = tf.pad(h3,
                     [[0, 0], [0, 0], [0, 0], [channels / 4, channels / 4]])
         h = h2 + h4
     return F.activation(h)
Example #6
0
 def esitmator_function(self, r):
     total_sum = 0
     n = len(self.all_sd)  # number of super-droplets
     for super_droplet in self.all_sd:
         total_sum += 1 / V * super_droplet.ksi * volume(
             super_droplet.r) * rho * w(
                 math.log(r) - math.log(super_droplet.r), n)
     return total_sum