MCPcopy Create free account
hub / github.com/DragonisCV/RAM / print_network

Method print_network

ram/models/base_model.py:148–165  ·  view source on GitHub ↗

Print the str and parameter number of a network. Args: net (nn.Module)

(self, net)

Source from the content-addressed store, hash-verified

146
147 @master_only
148 def print_network(self, net):
149 """Print the str and parameter number of a network.
150
151 Args:
152 net (nn.Module)
153 """
154 if isinstance(net, (DataParallel, DistributedDataParallel)):
155 net_cls_str = f'{net.__class__.__name__} - {net.module.__class__.__name__}'
156 else:
157 net_cls_str = f'{net.__class__.__name__}'
158
159 net = self.get_bare_model(net)
160 # net_str = str(net)
161 net_params = sum(map(lambda x: x.numel(), net.parameters()))
162
163 logger = get_root_logger()
164 logger.info(f'Network: {net_cls_str}, with parameters: {net_params:,d}')
165 # logger.info(net_str)
166
167 def _set_lr(self, lr_groups_l):
168 """Set learning rate for warm-up.

Callers 3

__init__Method · 0.80
__init__Method · 0.80
__init__Method · 0.80

Calls 2

get_bare_modelMethod · 0.95
get_root_loggerFunction · 0.90

Tested by

no test coverage detected