| 89 | self.train_op = tf.train.AdamOptimizer(1e-2).minimize(self.cost) |
| 90 | |
| 91 | def init_random(self, V): |
| 92 | preSoftmaxPi0 = np.zeros(self.M).astype(np.float32) # initial state distribution |
| 93 | preSoftmaxA0 = np.random.randn(self.M, self.M).astype(np.float32) # state transition matrix |
| 94 | preSoftmaxB0 = np.random.randn(self.M, V).astype(np.float32) # output distribution |
| 95 | |
| 96 | self.build(preSoftmaxPi0, preSoftmaxA0, preSoftmaxB0) |
| 97 | |
| 98 | def set(self, preSoftmaxPi, preSoftmaxA, preSoftmaxB): |
| 99 | op1 = self.preSoftmaxPi.assign(preSoftmaxPi) |