Ejemplo n.º 1
0
 def __init__(self, load_model=True):
     self.env_name = "carracing"
     self.vae = ConvVAE(batch_size=1,
                        gpu_mode=False,
                        is_training=False,
                        reuse=True)
     self.rnn = MDNRNN(hps_sample, gpu_mode=False, reuse=True)
     if load_model:
         self.vae.load_json('Weights/vae_weights.json')
         self.rnn.load_json('Weights/rnn_weights.json')
     self.state = rnn_init_state(self.rnn)
     self.rnn_mode = True
     self.input_size = rnn_output_size(EXP_MODE)
     self.z_size = 32
     if EXP_MODE == MODE_Z_HIDDEN:
         self.hidden_size = 40
         self.weight_hidden = np.random.randn(self.input_size,
                                              self.hidden_size)
         self.bias_hidden = np.random.randn(self.hidden_size)
         self.weight_output = np.random.randn(self.hidden_size, 3)
         self.bias_output = np.random.randn(3)
         self.param_count = ((self.input_size + 1) *
                             self.hidden_size) + (self.hidden_size * 3 + 3)
     else:
         self.weight = np.random.randn(self.input_size, 3)
         self.bias = np.random.randn(3)
         self.param_count = (self.input_size) * 3 + 3
     self.render_mode = False
Ejemplo n.º 2
0
 def reset(self):
     self.state = rnn_init_state(self.rnn)