24fe3d6576dd8f4cdd5f017805be689d6fa6be8c,baselines/ppo2/policies.py,LstmPolicy,__init__,#LstmPolicy#Any#Any#Any#Any#Any#Any#Any#,57
Before Change
def __init__(self, sess, ob_space, ac_space, nbatch, nsteps, nlstm=256, reuse=False):
nenv = nbatch // nsteps
nh, nw, nc = ob_space.shape
ob_shape = (nbatch, nh, nw, nc)
self.pdtype = make_pdtype(ac_space)
X = tf.placeholder(tf.uint8, ob_shape) //obs
M = tf.placeholder(tf.float32, [nbatch]) //mask (done t-1)
S = tf.placeholder(tf.float32, [nenv, nlstm*2]) //states
with tf.variable_scope("model", reuse=reuse):
h = nature_cnn(X)
xs = batch_to_seq(h, nenv, nsteps)
ms = batch_to_seq(M, nenv, nsteps)
h5, snew = lstm(xs, ms, S, "lstm1", nh=nlstm)
h5 = seq_to_batch(h5)
vf = fc(h5, "v", 1)
self.pd, self.pi = self.pdtype.pdfromlatent(h5)
v0 = vf[:, 0]
a0 = self.pd.sample()
neglogp0 = self.pd.neglogp(a0)
self.initial_state = np.zeros((nenv, nlstm*2), dtype=np.float32)
def step(ob, state, mask):
return sess.run([a0, v0, snew, neglogp0], {X:ob, S:state, M:mask})
def value(ob, state, mask):
return sess.run(v0, {X:ob, S:state, M:mask})
self.X = X
self.M = M
self.S = S
self.vf = vf
After Change
def __init__(self, sess, ob_space, ac_space, nbatch, nsteps, nlstm=256, reuse=False):
nenv = nbatch // nsteps
self.pdtype = make_pdtype(ac_space)
X, processed_x = observation_input(ob_space, nbatch)
M = tf.placeholder(tf.float32, [nbatch]) //mask (done t-1)
S = tf.placeholder(tf.float32, [nenv, nlstm*2]) //states
In pattern: SUPERPATTERN
Frequency: 6
Non-data size: 10
Instances
Project Name: openai/baselines
Commit Name: 24fe3d6576dd8f4cdd5f017805be689d6fa6be8c
Time: 2018-05-21
Author: peterzhokhoff@gmail.com
File Name: baselines/ppo2/policies.py
Class Name: LstmPolicy
Method Name: __init__
Project Name: openai/baselines
Commit Name: 24fe3d6576dd8f4cdd5f017805be689d6fa6be8c
Time: 2018-05-21
Author: peterzhokhoff@gmail.com
File Name: baselines/ppo2/policies.py
Class Name: LstmPolicy
Method Name: __init__
Project Name: openai/baselines
Commit Name: 24fe3d6576dd8f4cdd5f017805be689d6fa6be8c
Time: 2018-05-21
Author: peterzhokhoff@gmail.com
File Name: baselines/ppo2/policies.py
Class Name: CnnPolicy
Method Name: __init__
Project Name: openai/baselines
Commit Name: 24fe3d6576dd8f4cdd5f017805be689d6fa6be8c
Time: 2018-05-21
Author: peterzhokhoff@gmail.com
File Name: baselines/a2c/policies.py
Class Name: LnLstmPolicy
Method Name: __init__
Project Name: openai/baselines
Commit Name: 24fe3d6576dd8f4cdd5f017805be689d6fa6be8c
Time: 2018-05-21
Author: peterzhokhoff@gmail.com
File Name: baselines/a2c/policies.py
Class Name: CnnPolicy
Method Name: __init__
Project Name: openai/baselines
Commit Name: 24fe3d6576dd8f4cdd5f017805be689d6fa6be8c
Time: 2018-05-21
Author: peterzhokhoff@gmail.com
File Name: baselines/ppo2/policies.py
Class Name: LnLstmPolicy
Method Name: __init__
Project Name: openai/baselines
Commit Name: 24fe3d6576dd8f4cdd5f017805be689d6fa6be8c
Time: 2018-05-21
Author: peterzhokhoff@gmail.com
File Name: baselines/a2c/policies.py
Class Name: LstmPolicy
Method Name: __init__