(h)
Wraps hidden states in new Variables, to detach them from their history.
Wraps hidden states in new Variables, to detach them from their history.
Wraps hidden states in new Variables to detach them from their history .
def repackage_hidden(h):
    """Wraps hidden states in new Variables, to detach them from their history."""
    if type(h) == Variable:
        return Variable(h.data)
    else:
        return tuple(repackage_hidden(v) for v in h)
def repackage_hidden ( h ) : if type ( h ) == Variable : return Variable ( h . data ) else : return tuple ( repackage_hidden ( v ) for v in h )