dmx.compressor.fx.tracer.Scope

class dmx.compressor.fx.tracer.Scope(module_path: str, module_type: Any)

Scope object that records the module path and the module type of a module. Scope is used to track the information of the module that contains a Node in a Graph of GraphModule.

Example

class Sub(torch.nn.Module):
def forward(self, x):

# This will be a call_method Node in GraphModule, # scope for this would be (module_path=”sub”, module_type=Sub) return x.transpose(1, 2)

class M(torch.nn.Module):
def __init__(self):

self.sub = Sub()

def forward(self, x):

# This will be a call_method Node as well, # scope for this would be (module_path=””, None) x = x.transpose(1, 2) x = self.sub(x) return x

Parameters:
  • module_path (str) – String describing the path to the module

  • module_type (Any) – type of the module

module_path

String describing the path to the module

Type:

str

module_type

type of the module

Type:

Any

__init__(module_path: str, module_type: Any)

Methods

__init__(module_path, module_type)