From 2d72ffdee11bbb665940d8eba4b52f7a7b269be5 Mon Sep 17 00:00:00 2001 From: Kartikeya Bhardwaj Date: Sun, 29 Nov 2020 19:32:32 +0530 Subject: [PATCH] 16_accel_sgd: Fixed average_sqr_grad function (#342) Co-authored-by: Kartikeya --- 16_accel_sgd.ipynb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/16_accel_sgd.ipynb b/16_accel_sgd.ipynb index 573913f..b5284a3 100644 --- a/16_accel_sgd.ipynb +++ b/16_accel_sgd.ipynb @@ -746,7 +746,7 @@ "source": [ "def average_sqr_grad(p, sqr_mom, sqr_avg=None, **kwargs):\n", " if sqr_avg is None: sqr_avg = torch.zeros_like(p.grad.data)\n", - " return {'sqr_avg': sqr_avg*sqr_mom + p.grad.data**2}" + " return {'sqr_avg': sqr_mom*sqr_avg + (1-sqr_mom)*p.grad.data**2}" ] }, { @@ -1321,4 +1321,4 @@ }, "nbformat": 4, "nbformat_minor": 2 -} +} \ No newline at end of file