import tensorflow as tf

class A2C(Base):
    def __init__(self, env, summary_dir='./', gpu=False):

        self.LR = 1e-4
        self.MINIBATCH = 32
        self.EPOCHS = 8
        self.EPSILON = 0.2
        self.EPS_LEN = 100000
        # GPU setup
        os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
        config = tf.ConfigProto(allow_soft_placement=True, log_device_placement=False, device_count={'GPU': gpu})
        config.gpu_options.allow_growth = True
        config.gpu_options.per_process_gpu_memory_fraction = 0.5
        # Placeholders
        self.sess = tf.Session(config=config)
        self.s_dim, self.a_dim = env.observation_space.shape, env.action_space.shape[0]
        self.a_bound = (env.action_space.high - env.action_space.low) / 2
        self.actions = tf.placeholder(tf.float32, [None, self.a_dim], 'action')
        self.state = tf.placeholder(tf.float32, [None, self.s_dim[0]], 'state')
        self.advantage = tf.placeholder(tf.float32, [None, 1], 'advantage')
