Skip to content

Commit 46e237c

Browse files
authored
Allow unassociated weight during trace; Instead of terminating with an error only raise a warning (#92)
1 parent b461f36 commit 46e237c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

deepview_profile/tracking/breakdown.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import collections
22
import math
33
import os
4+
import warnings
45

56
HierarchicalBreakdown = collections.namedtuple(
67
'HierarchicalBreakdown', ['operations', 'weights', 'peak_usage_bytes'])
@@ -48,8 +49,7 @@ def add_activation_entry(self, operation_name, size_bytes, stack_context):
4849
def add_weight_entry(
4950
self, weight_name, size_bytes, grad_size_bytes, stack_context):
5051
if len(stack_context.frames) == 0:
51-
raise ValueError(
52-
'Adding weight entry with no context to the breakdown.')
52+
warnings.warn(f"{weight_name} has no accociated context")
5353

5454
for entry in self._traverse_and_insert(
5555
self._weight_root, weight_name, stack_context):

0 commit comments

Comments
 (0)