From 27159c42a858f4705dd751b0efb3940929a59069 Mon Sep 17 00:00:00 2001 From: Tian <121000916+SylarTiaNII@users.noreply.github.com> Date: Sat, 22 Apr 2023 10:42:40 +0800 Subject: [PATCH] optimize memory allocation of optimizer (#53138) --- python/paddle/optimizer/optimizer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/paddle/optimizer/optimizer.py b/python/paddle/optimizer/optimizer.py index c9dcaf0e291..99d9ce31405 100644 --- a/python/paddle/optimizer/optimizer.py +++ b/python/paddle/optimizer/optimizer.py @@ -774,7 +774,7 @@ class Optimizer: ), "Optimizer set error, {} should in state dict".format( var_name ) - var.set_value(self._accumulators_holder[var_name]) + var.set_value(self._accumulators_holder.pop(var_name)) self._accumulators[name][param.name] = var return var -- GitLab