Updating metrics dict code and logic for all the graphs (#198)

* illustrating logic of metrics dict with vanilla nerf

* updated all graph impls

* clean up.

* cleanup.

* format.

Co-authored-by: Alexander Kristoffersen <akristoffersen@berkeley.edu>
This commit is contained in:
Ethan WeberandAlexander Kristoffersen authored and GitHub committed 2022-07-26 21:02:45 -07:00
1 parent 0777883fb6
commit 934bd4bd72
8 files changed
+43 -23

No files matched your search

+16
View File
@@ -126,3 +126,19 @@ def human_format(num):
k = 1000.0
magnitude = int(floor(log(num, k)))
return f"{(num / k**magnitude):.2f} {units[magnitude]}"
def scale_dict(dictionary: Dict[Any, Any], coefficients: DictConfig) -> Dict[Any, Any]:
"""Scale a dictionary in-place given a coefficients dictionary.
Args:
dictionary: input dict to be scaled.
coefficients: scalar dict config for holding coefficients.
Returns:
Input dict scaled by coefficients.
"""
for key in dictionary:
if key in coefficients:
dictionary[key] *= coefficients[key]
return dictionary