libcity.model.traffic_speed_prediction.FNN

class libcity.model.traffic_speed_prediction.FNN.FNN(config, data_feature)[源代码]

基类:libcity.model.abstract_traffic_state_model.AbstractTrafficStateModel

calculate_loss(batch)[源代码]

输入一个batch的数据,返回训练过程的loss,也就是需要定义一个loss函数

参数

batch (Batch) – a batch of input

返回

return training loss

返回类型

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

predict(batch)[源代码]

输入一个batch的数据,返回对应的预测值,一般应该是**多步预测**的结果,一般会调用nn.Moudle的forward()方法

参数

batch (Batch) – a batch of input

返回

predict result of this batch

返回类型

torch.tensor

training: bool