mirror of
https://github.com/wassname/kair_algorithms_draft.git
synced 2026-09-09 11:25:10 +08:00
Change demo file compatible to python2 (#40)
* Change demo file to python2 compatible * Add object to classes for compatibility with python2
This commit is contained in:
@@ -14,7 +14,7 @@ import numpy as np
|
||||
import torch
|
||||
|
||||
|
||||
class AbstractAgent:
|
||||
class AbstractAgent(object):
|
||||
"""Abstract Agent used for all agents.
|
||||
|
||||
Attributes:
|
||||
|
||||
@@ -11,7 +11,7 @@ from algorithms.common.helper_functions import get_n_step_info
|
||||
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
|
||||
|
||||
|
||||
class ReplayBuffer:
|
||||
class ReplayBuffer(object):
|
||||
"""Fixed-size buffer to store experience tuples.
|
||||
|
||||
Taken from Udacity deep-reinforcement-learning github repository:
|
||||
@@ -79,7 +79,7 @@ class ReplayBuffer:
|
||||
return len(self.buffer)
|
||||
|
||||
|
||||
class NStepTransitionBuffer:
|
||||
class NStepTransitionBuffer(object):
|
||||
"""Fixed-size buffer to store experience tuples.
|
||||
|
||||
Attributes:
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import operator
|
||||
|
||||
|
||||
class SegmentTree:
|
||||
class SegmentTree(object):
|
||||
""" Create SegmentTree.
|
||||
|
||||
Taken from OpenAI baselines github repository:
|
||||
|
||||
@@ -7,7 +7,7 @@ import random
|
||||
import numpy as np
|
||||
|
||||
|
||||
class GaussianNoise:
|
||||
class GaussianNoise(object):
|
||||
"""Gaussian Noise.
|
||||
|
||||
Taken from https://github.com/vitchyr/rlkit
|
||||
@@ -28,7 +28,7 @@ class GaussianNoise:
|
||||
return np.random.normal(0, sigma, size=self.action_dim)
|
||||
|
||||
|
||||
class OUNoise:
|
||||
class OUNoise(object):
|
||||
"""Ornstein-Uhlenbeck process.
|
||||
|
||||
Taken from Udacity deep-reinforcement-learning github repository:
|
||||
|
||||
Reference in New Issue
Block a user