What kind of error are you seeing?
Based on the provided code I would guess you might be running into a shape mismatch, as  you are currently redefining fc%d in the first loop, which would create a stack of layers as:
self.fc1 = nn.Linear(512, num_classes)
self.fc2 = nn.Linear(512, num_classes)
self.fc3 = nn.Linear(512, num_classes)