Skip to content

Commit df2fe0d

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 2d7f5d2 commit df2fe0d

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

machine_learning/automatic_differentiation.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,10 @@ def gradient(self, target: Variable, source: Variable) -> np.ndarray | None:
270270
# of variables with respect to the target
271271
dparam_doutput = self.derivative(param, operation)
272272
dparam_dtarget = dparam_doutput * partial_deriv[operation.output]
273-
partial_deriv[param] = partial_deriv.get(param, np.zeros_like(dparam_dtarget)) + dparam_dtarget
273+
partial_deriv[param] = (
274+
partial_deriv.get(param, np.zeros_like(dparam_dtarget))
275+
+ dparam_dtarget
276+
)
274277

275278
if param.result_of and param.result_of != OpType.NOOP:
276279
operation_queue.append(param.result_of)

0 commit comments

Comments
 (0)