(filename, activation, session)
| 172 | |
| 173 | @staticmethod |
| 174 | def load(filename, activation, session): |
| 175 | # TODO: would prefer to save activation to file too |
| 176 | npz = np.load(filename) |
| 177 | We = npz['arr_0'] |
| 178 | Wx = npz['arr_1'] |
| 179 | Wh = npz['arr_2'] |
| 180 | bh = npz['arr_3'] |
| 181 | h0 = npz['arr_4'] |
| 182 | Wo = npz['arr_5'] |
| 183 | bo = npz['arr_6'] |
| 184 | V, D = We.shape |
| 185 | _, M = Wx.shape |
| 186 | rnn = SimpleRNN(D, M, V, activation, session) |
| 187 | rnn.build(We, Wx, Wh, bh, h0, Wo, bo) |
| 188 | return rnn |
| 189 | |
| 190 | def generate(self, pi, word2idx): |
| 191 | # convert word2idx -> idx2word |
no test coverage detected