(x, weight_decay)
return out
Returns a deep set encoding of x.
Returns a deep set encoding of x.
Returns a deep set encoding of x .
def deep_set_encoder(x, weight_decay):
  """Returns a deep set encoding of x."""
  h = x
  for i in range(5):
    with tf.variable_scope('set_encoder_{}'.format(i + 1), reuse=tf.AUTO_REUSE):
      h, _ = conv(h, [3, 3], 64, 1, weight_decay)
      h = bn_for_deep_set_encoder(h, weight_decay)
      h = relu(h)
      h = tf.nn.max_pool(
          h, ksize=[1, 2, 2, 1], strides=[1, 2, 2, 1], padding='SAME')

  # Create the set representation of x.
  # Average pool to reduce [batch_size, X, X, 64] to [batch_size, 1, 1, 64].
  out = tf.nn.avg_pool2d(h, h.shape[1], h.shape[1], 'SAME')
  # Average over the batch size: [1, 1, 64].
  out = tf.reduce_mean(out, axis=0)
  out = tf.reshape(out, [1, 64])  # to make the shape known.
  return out
def deep_set_encoder ( x , weight_decay ) : h = x for i in range ( 5 ) : with tf . variable_scope ( 'set_encoder_{}' . format ( i + 1 ) , reuse = tf . AUTO_REUSE ) : h , _ = conv ( h , [ 3 , 3 ] , 64 , 1 , weight_decay ) h = bn_for_deep_set_encoder ( h , weight_decay ) h = relu ( h ) h = tf . nn . max_pool ( h , ksize = [ 1 , 2 , 2 , 1 ] , strides = [ 1 , 2 , 2 , 1 ] , padding = 'SAME' ) # Create the set representation of x. # Average pool to reduce [batch_size, X, X, 64] to [batch_size, 1, 1, 64]. out = tf . nn . avg_pool2d ( h , h . shape [ 1 ] , h . shape [ 1 ] , 'SAME' ) # Average over the batch size: [1, 1, 64]. out = tf . reduce_mean ( out , axis = 0 ) out = tf . reshape ( out , [ 1 , 64 ] ) # to make the shape known. return out