def choose_action(self, s): // run by a local
s = s[np.newaxis, :]
return sess.run(self.A, {self.s: s})[0]
def save_ckpt(self):
tl.files.exists_or_mkdir(self.scope)
After Change
with tf.name_scope("wrap_a_out"):
self.mu, self.sigma = self.mu * A_BOUND[1], self.sigma + 1e-5
normal_dist = tfd.Normal(self.mu, self.sigma) // for continuous action space
self.A = tf.clip_by_value(tf.squeeze(normal_dist.sample(1), axis=0), *A_BOUND)
return self.A.numpy()[0]
def save_ckpt(self): // save trained weights
tl.files.save_npz(self.actor.trainable_weights, name="model_actor.npz")