MCPcopy Create free account
hub / github.com/THUYimingLi/BackdoorBox / __init__

Method __init__

core/attacks/SleeperAgent.py:280–304  ·  view source on GitHub ↗
(self, 
                 train_dataset, 
                 test_dataset, 
                 model, 
                 loss, 
                 patch, 
                 random_patch, 
                 eps, 
                 y_target, 
                 y_source, 
                 poisoned_rate, 
                 source_num=0, 
                 schedule=None, 
                 seed=0, 
                 deterministic=False)

Source from the content-addressed store, hash-verified

278 schedule (dict): Training or testing global schedule. Default: None.
279 """
280 def __init__(self,
281 train_dataset,
282 test_dataset,
283 model,
284 loss,
285 patch,
286 random_patch,
287 eps,
288 y_target,
289 y_source,
290 poisoned_rate,
291 source_num=0,
292 schedule=None,
293 seed=0,
294 deterministic=False):
295 super(SleeperAgent, self).__init__(train_dataset, test_dataset,
296 model, loss, schedule, seed, deterministic)
297 self.patch = patch
298 self.random_patch = random_patch
299 self.eps = eps
300 self.y_target = y_target
301 self.y_source = y_source
302 self.poisoned_rate = poisoned_rate
303 self.crafted=False
304 self.source_num=source_num
305
306 def get_poisoned_dataset(self):
307 """ must call train to craft poisoned dataset before call this function """

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected