Avoid logging zeros (#139968)

Summary: title

Test Plan: NA

Differential Revision: D65582953

Pull Request resolved: https://github.com/pytorch/pytorch/pull/139968
Approved by: https://github.com/zou3519
This commit is contained in:
Laith Sakka
2024-11-14 15:46:49 +00:00
committed by PyTorch MergeBot
parent 216b6a952c
commit f98c601efe

View File

@ -162,11 +162,13 @@ class ReinplaceCounters:
# Track sizes of known not re-inplaced tensors (exclude dynamic shapes).
@classmethod
def add_missed_bytes(cls, trigger: ReInplaceTrigger, bytes: int):
if bytes != 0:
cls._values[f"missed_bytes_{trigger.name}"] += bytes
# Track number of not re-inplaced tensors.
@classmethod
def add_missed_opportunities(cls, trigger: ReInplaceTrigger, count: int):
if count != 0:
cls._values[f"missed_tensors_{trigger}"] += count
@classmethod