tcn

class TemporalBlock(n_inputs, n_outputs, kernel_size, stride, dilation, padding, dropout=0.2)[source]

Bases: paddle.fluid.dygraph.layers.Layer

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.

Parameters
  • 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)[source]

Defines the computation performed at every call. Should be overridden by all subclasses.

Parameters
  • *inputs (tuple) – unpacked tuple arguments

  • **kwargs (dict) – unpacked dict arguments

class TCN(input_channel, num_channels, kernel_size=2, dropout=0.2)[source]

Bases: paddle.fluid.dygraph.layers.Layer

forward(x)[source]

Apply temporal convolutional networks to the input tensor.

Parameters

x ([tensor]) – The input tensor with shape [batch_size, input_channel, sequence_length].

Returns

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

Return type

[tensor]