(self)
| 3855 | self.is_initialized = False |
| 3856 | |
| 3857 | def _init_params(self): |
| 3858 | self.X = [] |
| 3859 | init_weights_gate = WeightInitializer(str(self.gate_fn), mode=self.init) |
| 3860 | init_weights_act = WeightInitializer(str(self.act_fn), mode=self.init) |
| 3861 | |
| 3862 | Wf = init_weights_gate((self.n_in + self.n_out, self.n_out)) |
| 3863 | Wu = init_weights_gate((self.n_in + self.n_out, self.n_out)) |
| 3864 | Wc = init_weights_act((self.n_in + self.n_out, self.n_out)) |
| 3865 | Wo = init_weights_gate((self.n_in + self.n_out, self.n_out)) |
| 3866 | |
| 3867 | bf = np.zeros((1, self.n_out)) |
| 3868 | bu = np.zeros((1, self.n_out)) |
| 3869 | bc = np.zeros((1, self.n_out)) |
| 3870 | bo = np.zeros((1, self.n_out)) |
| 3871 | |
| 3872 | self.parameters = { |
| 3873 | "Wf": Wf, |
| 3874 | "Wu": Wu, |
| 3875 | "Wc": Wc, |
| 3876 | "Wo": Wo, |
| 3877 | "bf": bf, |
| 3878 | "bu": bu, |
| 3879 | "bc": bc, |
| 3880 | "bo": bo, |
| 3881 | } |
| 3882 | |
| 3883 | self.gradients = { |
| 3884 | "Wf": np.zeros_like(Wf), |
| 3885 | "Wu": np.zeros_like(Wu), |
| 3886 | "Wc": np.zeros_like(Wc), |
| 3887 | "Wo": np.zeros_like(Wo), |
| 3888 | "bf": np.zeros_like(bf), |
| 3889 | "bu": np.zeros_like(bu), |
| 3890 | "bc": np.zeros_like(bc), |
| 3891 | "bo": np.zeros_like(bo), |
| 3892 | } |
| 3893 | |
| 3894 | self.derived_variables = { |
| 3895 | "C": [], |
| 3896 | "A": [], |
| 3897 | "Gf": [], |
| 3898 | "Gu": [], |
| 3899 | "Go": [], |
| 3900 | "Gc": [], |
| 3901 | "Cc": [], |
| 3902 | "n_timesteps": 0, |
| 3903 | "current_step": 0, |
| 3904 | "dLdA_accumulator": None, |
| 3905 | "dLdC_accumulator": None, |
| 3906 | } |
| 3907 | |
| 3908 | self.is_initialized = True |
| 3909 | |
| 3910 | def _get_params(self): |
| 3911 | Wf = self.parameters["Wf"] |
no test coverage detected