dsipts.models.crossformer package

Submodules

dsipts.models.crossformer.attn module

class dsipts.models.crossformer.attn.AttentionLayer(d_model, n_heads, d_keys=None, d_values=None, mix=True, dropout=0.1)

Bases: Module

Initialize internal Module state, shared by both nn.Module and ScriptModule.

forward(queries, keys, values)

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class dsipts.models.crossformer.attn.FullAttention(scale=None, attention_dropout=0.1)

Bases: Module

Initialize internal Module state, shared by both nn.Module and ScriptModule.

forward(queries, keys, values)

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class dsipts.models.crossformer.attn.TwoStageAttentionLayer(seg_num, factor, d_model, n_heads, d_ff=None, dropout=0.1)

Bases: Module

Initialize internal Module state, shared by both nn.Module and ScriptModule.

forward(x)

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

dsipts.models.crossformer.cross_decoder module

class dsipts.models.crossformer.cross_decoder.Decoder(seg_len, d_layers, d_model, n_heads, d_ff, dropout, router=False, out_seg_num=10, factor=10)

Bases: Module

Initialize internal Module state, shared by both nn.Module and ScriptModule.

forward(x, cross)

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class dsipts.models.crossformer.cross_decoder.DecoderLayer(seg_len, d_model, n_heads, d_ff=None, dropout=0.1, out_seg_num=10, factor=10)

Bases: Module

Initialize internal Module state, shared by both nn.Module and ScriptModule.

forward(x, cross)

x: the output of last decoder layer cross: the output of the corresponding encoder layer

dsipts.models.crossformer.cross_embed module

class dsipts.models.crossformer.cross_embed.DSW_embedding(seg_len, d_model)

Bases: Module

Initialize internal Module state, shared by both nn.Module and ScriptModule.

forward(x)

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

dsipts.models.crossformer.cross_encoder module

class dsipts.models.crossformer.cross_encoder.Encoder(e_blocks, win_size, d_model, n_heads, d_ff, block_depth, dropout, in_seg_num=10, factor=10)

Bases: Module

Initialize internal Module state, shared by both nn.Module and ScriptModule.

forward(x)

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class dsipts.models.crossformer.cross_encoder.SegMerging(d_model, win_size, norm_layer=<class 'torch.nn.modules.normalization.LayerNorm'>)

Bases: Module

Initialize internal Module state, shared by both nn.Module and ScriptModule.

forward(x)

x: B, ts_d, L, d_model

class dsipts.models.crossformer.cross_encoder.scale_block(win_size, d_model, n_heads, d_ff, depth, dropout, seg_num=10, factor=10)

Bases: Module

Initialize internal Module state, shared by both nn.Module and ScriptModule.

forward(x)

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

Module contents