paddlets.models.anomaly.dl._mtad_gat.attention

class FeatOrTempAttention(feature_dim: int, in_chunk_len: int, dropout: float, alpha: int, embed_dim: Union[None, int] = None, use_gatv2: bool = True, use_bias: bool = True, name: str = 'feature')[source]

Bases: Layer

Feature/Temporal Graph Attention Layer.

Parameters
  • feature_dim (int) – The number of features.

  • in_chunk_len (int) – The size of the loopback window, i.e. the number of time steps feed to the model.

  • dropout (float) – The percentage of nodes to dropout.

  • alpha (float) – The negative slope used in the LeakyReLU activation function.

  • embed_dim (None|int) – The embedding dimension (output dimension of linear transformation).

  • use_gatv2 (bool) – Whether to use the modified attention mechanism of GATv2 instead of standard GAT.

  • use_bias (bool) – whether to include a bias term in the attention layer.

  • name (str) – Feature or Temporal Graph.

_feature_dim

The number of features/nodes.

Type

int

_in_chunk_len

The size of the loopback window, i.e. the number of time steps feed to the model.

Type

int

_dropout

The percentage of nodes to dropout.

Type

float

_alpha

The negative slope used in the LeakyReLU activation function.

Type

float

_embed_dim

The embedding dimension (output dimension of linear transformation).

Type

None|int

_use_gatv2

Whether to use the modified attention mechanism of GATv2 instead of standard GAT.

Type

bool

_use_bias

whether to include a bias term in the attention layer.

Type

bool

_name

Feature or Temporal Graph.

Type

str

_nodes_num

Number of nodes in a graph.

Type

int

_lin

The linear transformation layer.

Type

paddle.nn.Layer

_att

The attention parameter.

Type

paddle.Parameter

_bias

The bias parameter.

Type

paddle.Parameter

_leakyrelu

The LeakyReLU activation layer.

Type

paddle.nn.Layer

_sigmoid

The Sigmoid layer.

Type

paddle.nn.Layer

forward(x) Tensor[source]

Feature extraction based on graph attention network

Parameters

x (paddle.Tensor) – The input data.

Returns

Output of Layer.

Return type

paddle.Tensor