File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change 11# mypy: allow-untyped-defs
22import collections
3+ import logging
34import warnings
45from typing import Any , Union
56
1819)
1920from torch .fx .graph_module import _get_attr
2021
22+ log = logging .getLogger (__name__ )
23+
2124
2225class ConstantAttrMap (collections .abc .MutableMapping ):
2326 """A mapping class that understands how to use module constants (tensors,
@@ -198,7 +201,7 @@ def lift_constants_pass(
198201 elif isinstance (constant_val , torch .Tensor ):
199202 # Remove the parameterness of constant_val
200203 if isinstance (constant_val , torch .nn .Parameter ):
201- warnings . warn (
204+ log . debug (
202205 f"{ node .target } created when tracing { node .meta .get ('stack_trace' , '<unknown stack>' )} is a parameter. But"
203206 f"it's not registered with register_parameter(). export will treat it as a constant tensor"
204207 )
Original file line number Diff line number Diff line change @@ -78,7 +78,9 @@ def _unlift_inputs_as_getattr(
7878
7979 else :
8080 with gm .graph .inserting_after (input_node ):
81- getattr_node = gm .graph .get_attr (lifted_node )
81+ with warnings .catch_warnings ():
82+ warnings .simplefilter ("ignore" )
83+ getattr_node = gm .graph .get_attr (lifted_node )
8284 input_node .replace_all_uses_with (getattr_node )
8385 metadata = input_node .meta
8486 gm .graph .erase_node (input_node )
You can’t perform that action at this time.
0 commit comments