1. 程式人生 > 實用技巧 >tf.layers.Conv1D,1維卷積層

tf.layers.Conv1D,1維卷積層

@tf_export(v1=['layers.Conv1D'])
class Conv1D(keras_layers.Conv1D, base.Layer):
  """1D convolution layer (e.g. temporal convolution).

  This layer creates a convolution kernel that is convolved
  (actually cross-correlated) with the layer input to produce a tensor of
  outputs. If `use_bias` is True (and a `bias_initializer` is provided),
  a bias vector is created and added to the outputs. Finally, if
  `activation` is not `None`, it is applied to the outputs as well.
這個Layer建立一個卷積核對input進行卷積併產生一個outputs tensor。如果use_bias is True並且提供了bias_initializer,一個bias向量會被新增到outputs。如果activation不是None,那也會被應用到outputs。

  Arguments:
    filters: Integer, the dimensionality of the output space (i.e. the number
      of filters in the convolution).
filters:int型,filters的個數,對應output的維度;

    kernel_size: An integer or tuple/list of a single integer, specifying the
      length of the 1D convolution window.
kernel_size:int, 指定1D卷積視窗的大小。

    strides: An integer or tuple/list of a single integer,
      specifying the stride length of the convolution.
      Specifying any stride value != 1 is incompatible with specifying
      any `dilation_rate` value != 1.
strides:int, 指定卷積的步長。stride!=1與dilation_rate!=1不相容。

    padding: One of `"valid"` or `"same"` (case-insensitive).
padding:valid或same(stride>1時,邊界會補0)。

    data_format: A string, one of `channels_last` (default) or `channels_first`.
      The ordering of the dimensions in the inputs.
      `channels_last` corresponds to inputs with shape
      `(batch, length, channels)` while `channels_first` corresponds to
      inputs with shape `(batch, channels, length)`.
data_format:string, channels_last(預設)或channels_first。inputs的維度順序。
channels_last表示輸入的shape=(batch, length, channels);
channels_first表示輸入的shape=(batch, channels, length);

    dilation_rate: An integer or tuple/list of a single integer, specifying
      the dilation rate to use for dilated convolution.
      Currently, specifying any `dilation_rate` value != 1 is
      incompatible with specifying any `strides` value != 1.
dilation_rate:int,用於dilated卷積的dilation rate,dilation_rate!=1與strides!=1不相容。也就是說,如果要讓dilation_rate!=1,那麼strides必須為1。

    activation: Activation function. Set it to None to maintain a
      linear activation.
activation:啟用函式。

    use_bias: Boolean, whether the layer uses a bias.
use_bias:bool,是否使用bias。

    kernel_initializer: An initializer for the convolution kernel.
kernel_initializer:卷積核的初始化方法。

    bias_initializer: An initializer for the bias vector. If None, the default
      initializer will be used.
bias_initializer:bias向量的初始化方法。

    kernel_regularizer: Optional regularizer for the convolution kernel.
kernel_regularizer:可選,用於卷積核的regularizer。

    bias_regularizer: Optional regularizer for the bias vector.
bias_regularizer:可選,用於bias向量的regularizer。

    activity_regularizer: Optional regularizer function for the output.
activity_regularizer:可選,用於output的regularizer。

    kernel_constraint: Optional projection function to be applied to the
        kernel after being updated by an `Optimizer` (e.g. used to implement
        norm constraints or value constraints for layer weights). The function
        must take as input the unprojected variable and must return the
        projected variable (which must have the same shape). Constraints are
        not safe to use when doing asynchronous distributed training.
kernel_constraint:可選,將一個對映函式應用到被Optimizer更新後的kernel(比如用於對layer weights實現norm約束或value約束)。這個函式必須能夠接受input作為未對映變數並返回一個相同形狀的對映變數。進行非同步分散式訓練的時候,約束是不安全的。

    bias_constraint: Optional projection function to be applied to the
        bias after being updated by an `Optimizer`.
bias_constraint:可選,講一個對映函式應用到被Optimizer更新後的bias。

    trainable: Boolean, if `True` also add variables to the graph collection
      `GraphKeys.TRAINABLE_VARIABLES` (see `tf.Variable`).
trainable:布林,如果是True,那麼也會將variables新增到圖集合中。 `GraphKeys.TRAINABLE_VARIABLES` (參考`tf.Variable`)

    name: A string, the name of the layer.
name:string,名字。
  """