libcity.model.trajectory_loc_prediction.ATSTLSTM¶
-
class
libcity.model.trajectory_loc_prediction.ATSTLSTM.ATSTLSTM(config, data_feature)[源代码]¶ 基类:
libcity.model.abstract_model.AbstractModelATST_LSTM 轨迹下一跳预测模型.
-
calculate_loss(batch)[源代码]¶ 计算模型损失(不包含正则项) :param batch: 输入 :type batch: libcity.data.batch
- 返回
shape () 损失
- 返回类型
(torch.tensor.Tensor)
-
forward(batch)[源代码]¶ Defines the computation performed at every call.
Should be overridden by all subclasses.
注解
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.
-
predict(batch)[源代码]¶ - 参数
batch (Batch) – a batch of input
- 返回
predict result of this batch
- 返回类型
torch.tensor
-
training: bool¶
-
-
class
libcity.model.trajectory_loc_prediction.ATSTLSTM.Attn(hidden_size)[源代码]¶ 基类:
torch.nn.modules.module.ModuleAttention 注意力机制模块, 对 LSTM 中间层输出做加权平均.
-
forward(x)[源代码]¶ 前向传播. :param x: shape (batch, seq_len, hidden_size) 中间层输出序列 :type x: torch.tensor.Tensor
- 返回
shape (batch, size)
- 返回类型
(torch.tensor.Tensor)
-
training: bool¶
-