(filename, activation)
| 126 | |
| 127 | @staticmethod |
| 128 | def load(filename, activation): |
| 129 | # TODO: would prefer to save activation to file too |
| 130 | npz = np.load(filename) |
| 131 | We = npz['arr_0'] |
| 132 | Wx = npz['arr_1'] |
| 133 | Wh = npz['arr_2'] |
| 134 | bh = npz['arr_3'] |
| 135 | h0 = npz['arr_4'] |
| 136 | Wo = npz['arr_5'] |
| 137 | bo = npz['arr_6'] |
| 138 | V, D = We.shape |
| 139 | _, M = Wx.shape |
| 140 | rnn = SimpleRNN(D, M, V) |
| 141 | rnn.set(We, Wx, Wh, bh, h0, Wo, bo, activation) |
| 142 | return rnn |
| 143 | |
| 144 | def set(self, We, Wx, Wh, bh, h0, Wo, bo, activation): |
| 145 | self.f = activation |
no test coverage detected