import tensorflow as tf

      wd: add L2Loss weight decay multiplied by this float. If None, weight
          decay is not added for this Variable.
      use_xavier: bool, whether to use xavier initializer

    Returns:
      Variable Tensor
    """
    if use_xavier:
        initializer = tf.contrib.layers.xavier_initializer()
        var = _variable_on_cpu(name, shape, initializer)
    else:
        # initializer = tf.truncated_normal_initializer(stddev=stddev)
        with tf.device('/cpu:0'):
            var = tf.truncated_normal(shape, stddev=np.sqrt(2 / shape[-1]))
            var = tf.round(var * tf.constant(1000, dtype=tf.float32)) / tf.constant(1000, dtype=tf.float32)
            var = tf.Variable(var, name='weights')
    if wd is not None:
        weight_decay = tf.multiply(tf.nn.l2_loss(var), wd, name='weight_loss')
        tf.add_to_collection('losses', weight_decay)
    return var


def conv1d(inputs,
           num_output_channels,
           kernel_size,
           scope,
           stride=1,
           padding='SAME',
