alpaca/alpacka/agents/shooting_test.py
def construct_episodes(actions, rewards):
    """Constructs episodes from actions and rewards nested lists."""
    episodes = []
    for acts, rews in zip(actions, rewards):
        transitions = [
            # TODO(koz4k): Initialize using kwargs.
            data.Transition(None, act, rew, False, None, {})
            for act, rew in zip(acts[:-1], rews[:-1])]
        transitions.append(
            data.Transition(None, acts[-1], rews[-1], True, None, {}))
        transition_batch = data.nested_stack(transitions)
        episodes.append(data.Episode(transition_batch, sum(rews)))
    return episodes
Constructs episodes from actions and rewards nested lists.
Constructs episodes from actions and rewards nested lists.
Constructs episodes from actions and rewards nested lists .
def construct_episodes(actions, rewards):
    episodes = []
    for acts, rews in zip(actions, rewards):
        transitions = [
            data.Transition(None, act, rew, False, None, {})
            for act, rew in zip(acts[:-1], rews[:-1])]
        transitions.append(
            data.Transition(None, acts[-1], rews[-1], True, None, {}))
        transition_batch = data.nested_stack(transitions)
        episodes.append(data.Episode(transition_batch, sum(rews)))
    return episodes
def construct_episodes ( actions , rewards ) : episodes = [ ] for acts , rews in zip ( actions , rewards ) : transitions = [ data . Transition ( None , act , rew , False , None , { } ) for act , rew in zip ( acts [ : - 1 ] , rews [ : - 1 ] ) ] transitions . append ( data . Transition ( None , acts [ - 1 ] , rews [ - 1 ] , True , None , { } ) ) transition_batch = data . nested_stack ( transitions ) episodes . append ( data . Episode ( transition_batch , sum ( rews ) ) ) return episodes
Constructs episodes from actions and rewards nested lists.
Constructs episodes from actions and rewards nested lists .
"""Constructs episodes from actions and rewards nested lists.""" # TODO(koz4k): Initialize using kwargs.
actions
rewards