Skip to content

Commit

Permalink
Fix: CustomTracer originally failed to trace Tensor object
Browse files Browse the repository at this point in the history
  • Loading branch information
hengyujiang committed Nov 16, 2024
1 parent 90c7af1 commit 48753df
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions mmrazor/models/task_modules/tracer/fx/custom_tracer.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ def _get_attrs(target, attrs):
if isinstance(attr, nn.Module):
module_dict[node.target] = nn.Module()
special_nodes.append(node)
#; the original design fails to
#; trace any Tensor object
elif isinstance(attr, torch.Tensor):
module_dict[node.target] = attr
elif node.op == 'call_method':
for special_node in special_nodes:
if special_node in node.args or \
Expand Down

0 comments on commit 48753df

Please sign in to comment.