Reset Optimizer counter while deserializing netWithBackwardOptions

Summary: Add ability to reset optimizer counter..

Test Plan: will wait for integration tests to run on diff.

Differential Revision: D27248286

fbshipit-source-id: a608df1bd61b64eb317c9ffd9cfdd804c5288f6d
This commit is contained in:
Neha Shah
2021-03-23 11:13:08 -07:00
committed by Facebook GitHub Bot
parent ba9f12d235
commit f3c00047ce

View File

@ -22,6 +22,14 @@ FP16_ENGINES = ["SIMD_Q_FP16", "SIMD_Q_STOC_FP16", "SIMD_Q_STOC_MKL_FP16"]
logger = logging.getLogger(__name__)
def reset_optimizer_instance_count():
"""
This function clears the _optimizer_instance_count. And keeps it
empty. This functionality is needed in some situations where
optimizer instance count might not reset even though the workplace is reset.
"""
_optimizer_instance_count.clear()
class Optimizer(object):
def __init__(self):