def save(self, doc):
        if doc.id:
            return self.update(doc)
        else:
            return self.insert(doc)
def tearDown(self):
        if hasattr(self, "rng_state"):
            torch.set_rng_state(self.rng_state)