MNT Assign inplace_derivative outside of the loop
@@ -244,10 +244,10 @@ class BaseMultilayerPerceptron(BaseEstimator, metaclass=ABCMeta):
self._compute_loss_grad(
last, n_samples, activations, deltas, coef_grads, intercept_grads)
+ inplace_derivative = DERIVATIVES[self.activation]
# Iterate over the hidden layers
for i in range(self.n_layers_ - 2, 0, -1):
deltas[i - 1] = safe_sparse_dot(deltas[i], self.coefs_[i].T)
- inplace_derivative = DERIVATIVES[self.activation]
inplace_derivative(activations[i], deltas[i - 1])
self._compute_loss_grad(
