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

Method add_trigger

core/attacks/AdaptivePatch.py:75–82  ·  view source on GitHub ↗
(img)

Source from the content-addressed store, hash-verified

73 """
74
75 def add_trigger(img):
76 if img.dim() == 2:
77 img = img.unsqueeze(0)
78 img = self.add_trigger(img)
79 img = img.squeeze()
80 else:
81 img = self.add_trigger(img)
82 return img
83
84 if type(img) == PIL.Image.Image:
85 img = F.pil_to_tensor(img)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected