(inputs, hparams)
Builds the ConvNet from Kelz 2016.
Builds the ConvNet from Kelz 2016.
Builds the ConvNet from Kelz 2016 .
def conv_net(inputs, hparams):
  """Builds the ConvNet from Kelz 2016."""
  with slim.arg_scope(
      [slim.conv2d, slim.fully_connected],
      activation_fn=tf.nn.relu,
      weights_initializer=slim.variance_scaling_initializer(
          factor=2.0, mode='FAN_AVG', uniform=True)):

    net = inputs
    i = 0
    for (conv_temporal_size, conv_freq_size,
         num_filters, freq_pool_size, dropout_amt) in zip(
             hparams.temporal_sizes, hparams.freq_sizes, hparams.num_filters,
             hparams.pool_sizes, hparams.dropout_keep_amts):
      net = slim.conv2d(
          net,
          num_filters, [conv_temporal_size, conv_freq_size],
          scope='conv' + str(i),
          normalizer_fn=slim.batch_norm)
      if freq_pool_size > 1:
        net = slim.max_pool2d(
            net, [1, freq_pool_size],
            stride=[1, freq_pool_size],
            scope='pool' + str(i))
      if dropout_amt < 1:
        net = slim.dropout(net, dropout_amt, scope='dropout' + str(i))
      i += 1

    # Flatten while preserving batch and time dimensions.
    dims = tf.shape(net)
    net = tf.reshape(
        net, (dims[0], dims[1], net.shape[2] * net.shape[3]),
        'flatten_end')

    net = slim.fully_connected(net, hparams.fc_size, scope='fc_end')
    net = slim.dropout(net, hparams.fc_dropout_keep_amt, scope='dropout_end')

    return net
def conv_net ( inputs , hparams ) : with slim . arg_scope ( [ slim . conv2d , slim . fully_connected ] , activation_fn = tf . nn . relu , weights_initializer = slim . variance_scaling_initializer ( factor = 2.0 , mode = 'FAN_AVG' , uniform = True ) ) : net = inputs i = 0 for ( conv_temporal_size , conv_freq_size , num_filters , freq_pool_size , dropout_amt ) in zip ( hparams . temporal_sizes , hparams . freq_sizes , hparams . num_filters , hparams . pool_sizes , hparams . dropout_keep_amts ) : net = slim . conv2d ( net , num_filters , [ conv_temporal_size , conv_freq_size ] , scope = 'conv' + str ( i ) , normalizer_fn = slim . batch_norm ) if freq_pool_size > 1 : net = slim . max_pool2d ( net , [ 1 , freq_pool_size ] , stride = [ 1 , freq_pool_size ] , scope = 'pool' + str ( i ) ) if dropout_amt < 1 : net = slim . dropout ( net , dropout_amt , scope = 'dropout' + str ( i ) ) i += 1 # Flatten while preserving batch and time dimensions. dims = tf . shape ( net ) net = tf . reshape ( net , ( dims [ 0 ] , dims [ 1 ] , net . shape [ 2 ] * net . shape [ 3 ] ) , 'flatten_end' ) net = slim . fully_connected ( net , hparams . fc_size , scope = 'fc_end' ) net = slim . dropout ( net , hparams . fc_dropout_keep_amt , scope = 'dropout_end' ) return net