Enable ruff NPY002 rule (#11336)

This commit is contained in:
Maxim Smolskiy
2024-04-01 22:39:31 +03:00
committed by GitHub
parent 39daaf8248
commit f8a948914b
9 changed files with 32 additions and 25 deletions

View File

@@ -51,8 +51,9 @@ class DenseLayer:
self.is_input_layer = is_input_layer
def initializer(self, back_units):
self.weight = np.asmatrix(np.random.normal(0, 0.5, (self.units, back_units)))
self.bias = np.asmatrix(np.random.normal(0, 0.5, self.units)).T
rng = np.random.default_rng()
self.weight = np.asmatrix(rng.normal(0, 0.5, (self.units, back_units)))
self.bias = np.asmatrix(rng.normal(0, 0.5, self.units)).T
if self.activation is None:
self.activation = sigmoid
@@ -174,7 +175,8 @@ class BPNN:
def example():
x = np.random.randn(10, 10)
rng = np.random.default_rng()
x = rng.normal(size=(10, 10))
y = np.asarray(
[
[0.8, 0.4],