I’m not sure what you mean about the updated myloss(), I removed that altogether. Are you referring to this?
fitness = torch.tensor(land, dtype=torch.float)
fitness.requires_grad = True

return(fitness)

That’s from the playgame() function. I did this because otherwise I got an error about integers not having a ‘size’ attribute.
So far I’ve felt pretty sure that it’s the playgame() function detaching things somehow, but I also just tested the forward pass itself. It looks like a pretty standard network architecture, and it’s applying weights to the zerod tensor. But when I print the .grad attribute for its output, that also gets None.
class TwoLayerNet(nn.Module):
    def __init__(self):
        super().__init__()
        self.fc1 = nn.Linear(438,100)
        self.fc2 = nn.Linear(100,438)
    def forward(self, x):
        x = F.sigmoid(self.fc1(x))
        x = F.sigmoid(self.fc2(x))
        return x

m = TwoLayerNet()
for i in range(training_epochs):

    fpass = m(blanktensor)
    print(fpass.grad)

So maybe there’s some kind of issue with this as well?