(filename, activation)
| 95 | |
| 96 | @staticmethod |
| 97 | def load(filename, activation): |
| 98 | # TODO: would prefer to save activation to file too |
| 99 | npz = np.load(filename) |
| 100 | Wx = npz['arr_0'] |
| 101 | Wh = npz['arr_1'] |
| 102 | bh = npz['arr_2'] |
| 103 | h0 = npz['arr_3'] |
| 104 | Wo = npz['arr_4'] |
| 105 | bo = npz['arr_5'] |
| 106 | V, M = Wx.shape |
| 107 | rnn = SimpleRNN(M, V) |
| 108 | rnn.set(Wx, Wh, bh, h0, Wo, bo, activation) |
| 109 | return rnn |
| 110 | |
| 111 | def set(self, Wx, Wh, bh, h0, Wo, bo, activation): |
| 112 | self.f = activation |