gnn_pathplanning
gnn_pathplanning copied to clipboard
The Training Time Problem(Solved)
Hello Bohan,
Thanks for your email.
According to the training time, you can try the following method.
- Use SSD to store the data,
- Use convert the N in to batch size B to speed up a bit of the training progress.
def forward(self, inputTensor):
B = inputTensor.shape[0] # batch size
# N = inputTensor.shape[1]
# C =
(B,N,C,W,H) = inputTensor.shape
# print(inputTensor.shape)
# print(B,N,C,W,H)
# B x G x N
input_currentAgent = inputTensor.reshape(B*N,C,W,H).to(self.config.device)
featureMap = self.ConvLayers(input_currentAgent).to(self.config.device)
featureMapFlatten = featureMap.view(featureMap.size(0), -1).to(self.config.device)
compressfeature = self.compressMLP(featureMapFlatten).to(self.config.device)
extractFeatureMap_old = compressfeature.reshape(B,N,self.numFeatures2Share).to(self.config.device)
extractFeatureMap = extractFeatureMap_old.permute([0,2,1]).to(self.config.device)
# DCP
for l in range(self.L):
# \\ Graph filtering stage:
# There is a 3*l below here, because we have three elements per
# layer: graph filter, nonlinearity and pooling, so after each layer
# we're actually adding elements to the (sequential) list.
self.GFL[2 * l].addGSO(self.S) # add GSO for GraphFilter
# B x F x N - > B x G x N,
sharedFeature = self.GFL(extractFeatureMap)
(_, num_G, _) = sharedFeature.shape
sharedFeature_permute =sharedFeature.permute([0,2,1]).to(self.config.device)
sharedFeature_stack = sharedFeature_permute.reshape(B*N,num_G)
action_predict = self.actionsMLP(sharedFeature_stack)
return action_predict
Thanks very much!