dsipts.models.crossformer.cross_encoder module¶
- class dsipts.models.crossformer.cross_encoder.SegMerging(d_model, win_size, norm_layer=nn.LayerNorm)[source]¶
Bases:
ModuleSegment Merging Layer. The adjacent `win_size’ segments in each dimension will be merged into one segment to get representation of a coarser scale we set win_size = 2 in our paper
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- class dsipts.models.crossformer.cross_encoder.scale_block(win_size, d_model, n_heads, d_ff, depth, dropout, seg_num=10, factor=10)[source]¶
Bases:
ModuleWe can use one segment merging layer followed by multiple TSA layers in each scale the parameter `depth’ determines the number of TSA layers used in each scale We set depth = 1 in the paper
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- __init__(win_size, d_model, n_heads, d_ff, depth, dropout, seg_num=10, factor=10)[source]¶
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(x)[source]¶
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
Moduleinstance 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.Encoder(e_blocks, win_size, d_model, n_heads, d_ff, block_depth, dropout, in_seg_num=10, factor=10)[source]¶
Bases:
ModuleThe Encoder of Crossformer.
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- __init__(e_blocks, win_size, d_model, n_heads, d_ff, block_depth, dropout, in_seg_num=10, factor=10)[source]¶
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(x)[source]¶
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
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.