<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def repackage_hidden(self, h):
 """Wraps hidden states in new Variables, to detach them from their history."""

        if isinstance(h, Variable):
            return torch.tensor(h.data, device=h.device)
        else:
            return tuple(self.repackage_hidden(v) for v in h)