Repackage_hidden function in word_language_model example
Can you pls explain what this function do? <SCODE>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)<ECODE>
erogol
apaszke
I see thank you. Is this a general practice for BPTT in pytorch or just memory efficiency?
erogol
apaszke