nncf
nncf copied to clipboard
How to get the corresponding torch.nn.Module instance given an op_exec_context string?
Thanks.
op_exec_context
is an instance of OperationExecutionContext
which has self.op_address: OperationAddress
.
https://github.com/openvinotoolkit/nncf/blob/9b9c3b36704fe8fe46296573993af12ea16c8294/nncf/torch/dynamic_graph/graph.py#L105-L120
OperationAddress
includes Scope
.
https://github.com/openvinotoolkit/nncf/blob/9b9c3b36704fe8fe46296573993af12ea16c8294/nncf/torch/dynamic_graph/operation_address.py#L13-L20
Then, Scope
is used to find nn.module
.
https://github.com/openvinotoolkit/nncf/blob/9b9c3b36704fe8fe46296573993af12ea16c8294/nncf/torch/nncf_network.py#L577-L592