mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-15 06:52:39 +02:00
fix: replacing np.power with np.square for efficiency
This commit is contained in:
parent
cb4f05296f
commit
c3d8ea2e0d
1 changed files with 2 additions and 2 deletions
|
|
@ -35,7 +35,7 @@ class MLP(Mapping):
|
||||||
|
|
||||||
# Backpropagation to hidden layer.
|
# Backpropagation to hidden layer.
|
||||||
dL_dact = np.dot(dL_dF, self.W2.T)
|
dL_dact = np.dot(dL_dF, self.W2.T)
|
||||||
dL_dlayer1 = dL_dact * (1 - np.power(activations, 2))
|
dL_dlayer1 = dL_dact * (1 - np.square(activations))
|
||||||
|
|
||||||
# Finally, evaluate the first-layer gradients.
|
# Finally, evaluate the first-layer gradients.
|
||||||
self.W1.gradient = np.dot(X.T,dL_dlayer1)
|
self.W1.gradient = np.dot(X.T,dL_dlayer1)
|
||||||
|
|
@ -47,7 +47,7 @@ class MLP(Mapping):
|
||||||
|
|
||||||
# Backpropagation to hidden layer.
|
# Backpropagation to hidden layer.
|
||||||
dL_dact = np.dot(dL_dF, self.W2.T)
|
dL_dact = np.dot(dL_dF, self.W2.T)
|
||||||
dL_dlayer1 = dL_dact * (1 - np.power(activations, 2))
|
dL_dlayer1 = dL_dact * (1 - np.square(activations))
|
||||||
|
|
||||||
return np.dot(dL_dlayer1, self.W1.T)
|
return np.dot(dL_dlayer1, self.W1.T)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue