tcn#

class TemporalBlock(n_inputs, n_outputs, kernel_size, stride, dilation, padding, dropout=0.2)[源代码]#

The TCN block, consists of dilated causal conv, relu and residual block. See the Figure 1(b) in https://arxiv.org/pdf/1803.01271.pdf for more details.

参数:
  • n_inputs (int) -- The number of channels in the input tensor.

  • n_outputs (int) -- The number of filters.

  • kernel_size (int) -- The filter size.

  • stride (int) -- The stride size.

  • dilation (int) -- The dilation size.

  • padding (int) -- The size of zeros to be padded.

  • dropout (float, optional) -- Probability of dropout the units. Defaults to 0.2.

forward(x)[源代码]#
参数:

x (Tensor) -- The input tensor with a shape of [batch_size, input_channel, sequence_length].

class TCN(input_channel, num_channels, kernel_size=2, dropout=0.2)[源代码]#
forward(x)[源代码]#

Apply temporal convolutional networks to the input tensor.

参数:

x (Tensor) -- The input tensor with a shape of [batch_size, input_channel, sequence_length].

返回:

The output tensor with a shape of [batch_size, num_channels[-1], sequence_length].

返回类型:

Tensor