(self, save_path)
| 53 | self.thre_bp3 = -2 * rng.random(self.num_bp3) + 1 |
| 54 | |
| 55 | def save_model(self, save_path): |
| 56 | # save model dict with pickle |
| 57 | model_dic = { |
| 58 | "num_bp1": self.num_bp1, |
| 59 | "num_bp2": self.num_bp2, |
| 60 | "num_bp3": self.num_bp3, |
| 61 | "conv1": self.conv1, |
| 62 | "step_conv1": self.step_conv1, |
| 63 | "size_pooling1": self.size_pooling1, |
| 64 | "rate_weight": self.rate_weight, |
| 65 | "rate_thre": self.rate_thre, |
| 66 | "w_conv1": self.w_conv1, |
| 67 | "wkj": self.wkj, |
| 68 | "vji": self.vji, |
| 69 | "thre_conv1": self.thre_conv1, |
| 70 | "thre_bp2": self.thre_bp2, |
| 71 | "thre_bp3": self.thre_bp3, |
| 72 | } |
| 73 | with open(save_path, "wb") as f: |
| 74 | pickle.dump(model_dic, f) |
| 75 | |
| 76 | print(f"Model saved: {save_path}") |
| 77 | |
| 78 | @classmethod |
| 79 | def read_model(cls, model_path): |
nothing calls this directly
no outgoing calls
no test coverage detected