8000 updated ornstein-uhlenbeck process to keep an own state for each acti… · pythonAI/tensorforce@0fc5ec2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0fc5ec2

Browse files
committed
updated ornstein-uhlenbeck process to keep an own state for each action dimension
1 parent cf5eb82 commit 0fc5ec2

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

tensorforce/core/explorations/ornstein_uhlenbeck_process.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ def __init__(
4343
super(OrnsteinUhlenbeckProcess, self).__init__(scope=scope, summary_labels=summary_labels)
4444

4545
def tf_explore(self, episode, timestep, action_shape):
46-
normal_sample = tf.random_normal(shape=(), mean=0.0, stddev=1.0)
47-
state = tf.get_variable(name='ornstein_uhlenbeck', dtype=util.tf_dtype('float'), initializer=(self.mu,))
48-
state = tf.assign_add(ref=state, value=(self.theta * (self.mu - state) + self.sigma * normal_sample))
49-
50-
return tf.reshape(state, shape=action_shape)
46+
normal_sample = tf.random_normal(shape=action_shape.shape, mean=0.0, stddev=1.0)
47+
state = tf.get_variable(name='ornstein_uhlenbeck', dtype=util.tf_dtype('float'), shape=action_shape.shape,
48+
initializer=tf.constant_initializer(self.mu))
49+
return tf.assign_add(ref=state, value=(self.theta * (self.mu - state) + self.sigma * normal_sample))

0 commit comments

Comments
 (0)
0