The shape mismatch seems to be raised in this line of code:
# need to take care of tensors dimension mismatch
graph.cells[c].nodes[n].connections[cc].combined_feature_map += \
    graph.cells[c].nodes[n].connections[cc].edges[e].forward_edge(x)  # Ltrain(w±, alpha)

so you could check the shapes of both tensors and make sure their shapes are matching so that the inplace addition can be executed. The commend above already seems to indicate potential shape mismatches there.