Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def forward(self, input, params=None):
for name, module in self._modules.items():
if isinstance(module, MetaModule):
input = module(input, params=get_subdict(params, name))
elif isinstance(module, nn.Module):
input = module(input)
else:
raise TypeError('The module must be either a torch module '
'(inheriting from `nn.Module`), or a `MetaModule`. '
'Got type: `{0}`'.format(type(module)))
return input
def forward(self, inputs, params=None):
features = self.features(inputs, params=get_subdict(params, 'features'))
features = features.view((features.size(0), -1))
logits = self.classifier(features, params=get_subdict(params, 'classifier'))
return logits
def forward(self, inputs, params=None):
features = self.features(inputs, params=get_subdict(params, 'features'))
features = features.view((features.size(0), -1))
logits = self.classifier(features, params=get_subdict(params, 'classifier'))
return logits