(self, x)
return x
linear layer for dim reduction
    x: shape [batch, time, feat, channel]
    output: shape [b, t, f]
linear layer for dim reduction
    x: shape [batch, time, feat, channel]
    output: shape [b, t, f]
linear layer for dim reduction x : shape [ batch time feat channel ] output : shape [ b t f ]
def linear_block(self, x):
    '''
    linear layer for dim reduction
    x: shape [batch, time, feat, channel]
    output: shape [b, t, f]
    '''
    batch_t = tf.shape(x)[0]
    time_t = tf.shape(x)[1]
    feat, channel = x.shape.as_list()[2:]
    linear_num = self.netconf['linear_num']

    if linear_num > 0:
      with tf.variable_scope('linear'):
        x = tf.reshape(x, [batch_t * time_t, feat * channel])

        if self.netconf['use_dropout']:
          x = tf.layers.dropout(
              x, self.netconf['dropout_rate'], training=self.train)

        x = common_layers.linear(x, 'linear1', [feat * channel, linear_num])

        x = tf.nn.relu(x)

        if self.netconf['use_bn']:
          bn_name = 'bn_linear'
          x = tf.layers.batch_normalization(
              x, axis=-1, momentum=0.9, training=self.train, name=bn_name)

        x = tf.reshape(x, [batch_t, time_t, linear_num])
    else:
      logging.info('linear_num <= 0, only apply reshape.')
      x = tf.reshape(x, [batch_t, time_t, feat * channel])

    return x
def linear_block ( self , x ) : batch_t = tf . shape ( x ) [ 0 ] time_t = tf . shape ( x ) [ 1 ] feat , channel = x . shape . as_list ( ) [ 2 : ] linear_num = self . netconf [ 'linear_num' ] if linear_num > 0 : with tf . variable_scope ( 'linear' ) : x = tf . reshape ( x , [ batch_t * time_t , feat * channel ] ) if self . netconf [ 'use_dropout' ] : x = tf . layers . dropout ( x , self . netconf [ 'dropout_rate' ] , training = self . train ) x = common_layers . linear ( x , 'linear1' , [ feat * channel , linear_num ] ) x = tf . nn . relu ( x ) if self . netconf [ 'use_bn' ] : bn_name = 'bn_linear' x = tf . layers . batch_normalization ( x , axis = - 1 , momentum = 0.9 , training = self . train , name = bn_name ) x = tf . reshape ( x , [ batch_t , time_t , linear_num ] ) else : logging . info ( 'linear_num <= 0, only apply reshape.' ) x = tf . reshape ( x , [ batch_t , time_t , feat * channel ] ) return x