libcity.model.trajectory_loc_prediction.GeoSAN

class libcity.model.trajectory_loc_prediction.GeoSAN.Embedding(vocab_size, num_units, zeros_pad=True, scale=True)[源代码]

基类:torch.nn.modules.module.Module

forward(inputs)[源代码]

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 Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

training: bool
class libcity.model.trajectory_loc_prediction.GeoSAN.GeoSAN(config, data_feature)[源代码]

基类:libcity.model.abstract_model.AbstractModel

calculate_loss(batch)[源代码]
参数

batch (Batch) – a batch of input

返回

return training loss

返回类型

torch.tensor

forward(src_user, src_loc, src_reg, src_time, src_square_mask, src_binary_mask, trg_loc, trg_reg, mem_mask, ds=None)[源代码]

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 Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

load(path)[源代码]
predict(batch)[源代码]
参数

batch (Batch) – a batch of input

返回

predict result of this batch

返回类型

torch.tensor

save(path)[源代码]
training: bool
class libcity.model.trajectory_loc_prediction.GeoSAN.PositionalEmbedding(d_model, dropout=0.1, max_len=120)[源代码]

基类:torch.nn.modules.module.Module

forward(x)[源代码]

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 Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

training: bool
class libcity.model.trajectory_loc_prediction.GeoSAN.PositionalEncoding(d_model, dropout=0.1, max_len=5000)[源代码]

基类:torch.nn.modules.module.Module

forward(x)[源代码]

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 Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

training: bool