MCPcopy Create free account
hub / github.com/Trustworthy-AI-Group/TransferAttack / __init__

Method __init__

transferattack/utils.py:83–92  ·  view source on GitHub ↗
(self, models, mode='mean')

Source from the content-addressed store, hash-verified

81
82class EnsembleModel(torch.nn.Module):
83 def __init__(self, models, mode='mean'):
84 super(EnsembleModel, self).__init__()
85 self.device = next(models[0].parameters()).device
86 for model in models:
87 model.to(self.device)
88 self.models = models
89 self.softmax = torch.nn.Softmax(dim=1)
90 self.type_name = 'ensemble'
91 self.num_models = len(models)
92 self.mode = mode
93
94 def forward(self, x):
95 outputs = []

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected