Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doubts on memory #9

Closed
random-user-x opened this issue Jun 15, 2018 · 0 comments
Closed

Doubts on memory #9

random-user-x opened this issue Jun 15, 2018 · 0 comments

Comments

@random-user-x
Copy link
Contributor

random-user-x commented Jun 15, 2018

ACER/memory.py

Line 24 in 3676af0

def sample(self, maxlen=0):

  def sample(self, maxlen=0):
    L = len(self.memory)
    if L > 0:
      e = random.randrange(L)
      mem = self.memory[e]
      T = len(mem)
      # Take a random subset of trajectory if maxlen specified, otherwise return full trajectory
      if maxlen > 0 and T > maxlen + 1:
        t = random.randrange(T - maxlen - 1)  # Include next state after final "maxlen" state
        return mem[t:t + maxlen + 1]
      else:
        return mem
    else :
      return None

Can we write the code in this way? I do not get the reason behind using while (True)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant