mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-05 09:21:13 +08:00
Enable ruff NPY002 rule (#11336)
This commit is contained in:
@ -41,15 +41,16 @@ class CNN:
|
||||
self.size_pooling1 = size_p1
|
||||
self.rate_weight = rate_w
|
||||
self.rate_thre = rate_t
|
||||
rng = np.random.default_rng()
|
||||
self.w_conv1 = [
|
||||
np.asmatrix(-1 * np.random.rand(self.conv1[0], self.conv1[0]) + 0.5)
|
||||
np.asmatrix(-1 * rng.random((self.conv1[0], self.conv1[0])) + 0.5)
|
||||
for i in range(self.conv1[1])
|
||||
]
|
||||
self.wkj = np.asmatrix(-1 * np.random.rand(self.num_bp3, self.num_bp2) + 0.5)
|
||||
self.vji = np.asmatrix(-1 * np.random.rand(self.num_bp2, self.num_bp1) + 0.5)
|
||||
self.thre_conv1 = -2 * np.random.rand(self.conv1[1]) + 1
|
||||
self.thre_bp2 = -2 * np.random.rand(self.num_bp2) + 1
|
||||
self.thre_bp3 = -2 * np.random.rand(self.num_bp3) + 1
|
||||
self.wkj = np.asmatrix(-1 * rng.random((self.num_bp3, self.num_bp2)) + 0.5)
|
||||
self.vji = np.asmatrix(-1 * rng.random((self.num_bp2, self.num_bp1)) + 0.5)
|
||||
self.thre_conv1 = -2 * rng.random(self.conv1[1]) + 1
|
||||
self.thre_bp2 = -2 * rng.random(self.num_bp2) + 1
|
||||
self.thre_bp3 = -2 * rng.random(self.num_bp3) + 1
|
||||
|
||||
def save_model(self, save_path):
|
||||
# save model dict with pickle
|
||||
|
Reference in New Issue
Block a user