Skip to content

Commit

Permalink
type -> basic_type
Browse files Browse the repository at this point in the history
  • Loading branch information
liukai committed Aug 10, 2022
1 parent 379cabd commit 8f13648
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions mmrazor/structures/graph/module_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ def in_channels(self) -> int:
for node in self.prev_nodes
])
else:
raise NotImplementedError(f'unsupported node type: {self.type}')
raise NotImplementedError(
f'unsupported node type: {self.basic_type}')

@property
def out_channels(self) -> int:
Expand Down Expand Up @@ -114,7 +115,8 @@ def out_channels(self) -> int:
for node in self.prev_nodes
])
else:
raise NotImplementedError(f'unsupported node type: {self.type}')
raise NotImplementedError(
f'unsupported node type: {self.basic_type}')

# other

Expand All @@ -124,7 +126,7 @@ def __repr__(self) -> str:
# node type

@property
def type(self) -> str:
def basic_type(self) -> str:
"""The basic type of the node.
Basic types are divided into seveval major types, detailed in
Expand Down Expand Up @@ -156,21 +158,21 @@ def type(self) -> str:
def is_pass_node(self):
"""pass node represent a module whose in-channels correspond out-
channels one-to-one."""
return self.type in ['bn', 'dwconv2d', 'pass_placeholder']
return self.basic_type in ['bn', 'dwconv2d', 'pass_placeholder']

def is_cat_node(self):
"""cat node represents a cat module."""
return self.type == 'cat_placeholder'
return self.basic_type == 'cat_placeholder'

def is_bind_node(self):
"""bind node represent a node that has multiple inputs, and their
channels are bound one-to-one."""
return self.type == 'bind_placeholder'
return self.basic_type == 'bind_placeholder'

def is_mix_node(self):
"""mix node represents a module that mixs all input channels and
generete new output channels, such as conv and linear."""
return self.type in ['conv2d', 'linear', 'gwconv2d']
return self.basic_type in ['conv2d', 'linear', 'gwconv2d']

# check

Expand Down

0 comments on commit 8f13648

Please sign in to comment.