danaugrs/huskarl

weird unpack

shtse8 opened this issue · 0 comments

def unpack(traces):

def unpack(traces):
    """Returns states, actions, rewards, end_states, and a mask for episode boundaries given traces."""
    states = [t[0].state for t in traces]
    actions = [t[0].action for t in traces]
    rewards = [[e.reward for e in t] for t in traces]
    end_states = [t[-1].nextState for t in traces]
    not_done_mask = [[1 if n.nextState is not None else 0 for n in t] for t in traces]
    return states, actions, rewards, end_states, not_done_mask

For my understanding, unpack function should unpack the traces into separated list for every elements.
But from the code, says states, it only take the first state on every buffer. and ignore all others.
I don't understand why.