In both stack traces self.fc1_std creates the NaN values.
Could you also check the value of logvar?
If it’s very high, logvar.mul(0.5).exp_() will create an Inf.
Try to add some canity checks in your code, e.g.
    def reparamtrization_trick(self, mu, logvar):
        if self.training:
            std = logvar.mul(0.5).exp_()
            if not torch.isfinite(std):
                print('ERROR! std is ', std)
            eps = torch.tensor(std.data.new(std.size()).normal_(0,1))
            return eps.mul(std).add(mu)