MCPcopy Create free account
hub / github.com/Anoise/WTFlib / DataEmbedding

Class DataEmbedding

LDPS_Graph/layers/Embed.py:105–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

103
104
105class DataEmbedding(nn.Module):
106 def __init__(self, c_in, d_model, embed_type='fixed', freq='h', dropout=0.1):
107 super(DataEmbedding, self).__init__()
108
109 self.value_embedding = TokenEmbedding(c_in=c_in, d_model=d_model)
110 self.position_embedding = PositionalEmbedding(d_model=d_model)
111 self.temporal_embedding = TemporalEmbedding(d_model=d_model, embed_type=embed_type,
112 freq=freq) if embed_type != 'timeF' else TimeFeatureEmbedding(
113 d_model=d_model, embed_type=embed_type, freq=freq)
114 self.dropout = nn.Dropout(p=dropout)
115
116 def forward(self, x, x_mark):
117 if x_mark==None:
118 x = self.value_embedding(x)
119 return self.dropout(x)
120
121 x = self.value_embedding(x) + self.temporal_embedding(x_mark) + self.position_embedding(x)
122 return self.dropout(x)
123
124
125class DataEmbedding_wo_pos(nn.Module):

Callers 4

__init__Method · 0.90
__init__Method · 0.90
__init__Method · 0.90
__init__Method · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected