(self, x, pooling_type=None)
return x
Add a pooling layer across the whole utterance.
      Input: [B, T, D]
        --> Reduce along T

      Statistics pooling output: [B, D * 2]
      Average pooling output: [B, D]
Add a pooling layer across the whole utterance.
      Input: [B, T, D]
        --> Reduce along T
Add a pooling layer across the whole utterance . Input : [ B T D ] -- > Reduce along T
def pooling_layer(self, x, pooling_type=None):
    '''
      Add a pooling layer across the whole utterance.
      Input: [B, T, D]
        --> Reduce along T

      Statistics pooling output: [B, D * 2]
      Average pooling output: [B, D]
    '''
    assert_rank3 = tf.debugging.assert_rank(x, 3)
    with tf.control_dependencies([assert_rank3]):
      x = tf.identity(x)

    pooling_type = pooling_type if pooling_type else self.netconf[
        'frame_pooling_type']
    if pooling_type == 'stats':
      with tf.name_scope('stats_pooling'):
        mean, var = tf.nn.moments(x, 1)
        x = tf.concat([mean, tf.sqrt(var + 1e-6)], 1)
    elif pooling_type == 'average':
      with tf.name_scope('average_pooling'):
        mean, _ = tf.nn.moments(x, 1)
        x = mean
    else:
      raise ValueError('Unsupported frame_pooling_type: %s' % (pooling_type))

    assert_rank2 = tf.debugging.assert_rank(x, 2)
    with tf.control_dependencies([assert_rank2]):
      x = tf.identity(x)

    return x
def pooling_layer ( self , x , pooling_type = None ) : assert_rank3 = tf . debugging . assert_rank ( x , 3 ) with tf . control_dependencies ( [ assert_rank3 ] ) : x = tf . identity ( x ) pooling_type = pooling_type if pooling_type else self . netconf [ 'frame_pooling_type' ] if pooling_type == 'stats' : with tf . name_scope ( 'stats_pooling' ) : mean , var = tf . nn . moments ( x , 1 ) x = tf . concat ( [ mean , tf . sqrt ( var + 1e-6 ) ] , 1 ) elif pooling_type == 'average' : with tf . name_scope ( 'average_pooling' ) : mean , _ = tf . nn . moments ( x , 1 ) x = mean else : raise ValueError ( 'Unsupported frame_pooling_type: %s' % ( pooling_type ) ) assert_rank2 = tf . debugging . assert_rank ( x , 2 ) with tf . control_dependencies ( [ assert_rank2 ] ) : x = tf . identity ( x ) return x