I think I found the reason show it works despite the wrong flattening. You’re last two lines in your forward() method are:
def forward(self, x, hs):
    ...
    out = self.fc(out)
    return out[-1], hs

The out[-1] resolves the “artificial” batch of 12 values so you have only 1 output value. If you would have done the flattening correctly the [-1] wouldn’t be needed. The problem is that you sticked too closely to the Udacity tutorial although your setup is different. So you had to make tweaks like the out[-1] to fix it.
It’s a bit like in math exam where you make a mistake at the beginning and an mistake at the end, and both mistakes cancel each other out.