paddlets.models.anomaly.dl._anomaly_transformer.embedding

class PositionalEmbedding(d_model: int, max_len: int = 5000)[source]

Bases: Layer

Compute the positional encodings once in log space.

Parameters
  • d_model (int) – The expected feature size for the input of the anomaly transformer.

  • max_len (int) – The dimensionality of the computed positional encoding array.

_nn

Dynamic graph LayerList.

Type

paddle.nn.Sequential

forward(x: Tensor) Tensor[source]

PositionalEmbedding Forward.

Parameters

x (paddle.Tensor) – Input tensor.

Returns

Output of PositionalEmbedding.

Return type

paddle.Tensor

class TokenEmbedding(c_in: int, d_model: int)[source]

Bases: Layer

Fills the input Tensor with values according to the method described in Delving deep into rectifiers:

Surpassing human-level performance on ImageNet classification - He, K. et al. (2015), using a normal distribution.

Parameters
  • c_in (int) – The Number of channels for Conv1D.

  • d_model (int) – The expected feature size for the input of the anomaly transformer.

_nn

Dynamic graph LayerList.

Type

paddle.nn.Sequential

forward(x: Tensor) Tensor[source]

TokenEmbedding Forward.

Parameters

x (paddle.Tensor) – Input tensor.

Returns

Output of TokenEmbedding.

Return type

paddle.Tensor

class DataEmbedding(c_in: int, d_model: int, dropout: int = 0.0)[source]

Bases: Layer

data embedding = PositionalEmbedding + TokenEmbedding.

Parameters
  • c_in (int) – The Number of channels for embedding.

  • d_model (int) – The expected feature size for the input of the anomaly transformer.

  • dropout (int) – Dropout regularization parameter.

_nn

Dynamic graph LayerList.

Type

paddle.nn.Sequential

forward(x: Tensor) Tensor[source]

DataEmbedding Forward.

Parameters

x (paddle.Tensor) – Input tensor.

Returns

Output of DataEmbedding.

Return type

paddle.Tensor