nncf icon indicating copy to clipboard operation
nncf copied to clipboard

How to get the corresponding torch.nn.Module instance given an op_exec_context string?

Open raymon-tian opened this issue 2 years ago • 1 comments

Thanks.

raymon-tian avatar Jul 07 '22 10:07 raymon-tian

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

vinnamkim avatar Jul 08 '22 05:07 vinnamkim