(self, x)
| 431 | self.pattern = pattern |
| 432 | |
| 433 | def __call__(self, x): |
| 434 | x = np.asarray(x) |
| 435 | mask, pattern = self.mask, self.pattern |
| 436 | |
| 437 | if len(x.shape) == 3: |
| 438 | mask = mask.reshape(*mask.shape, 1) |
| 439 | pattern = pattern.reshape(*pattern.shape, 1) |
| 440 | x_trigger = x * mask + pattern |
| 441 | # change numpy array back to PIL.Image |
| 442 | x_trigger = Image.fromarray(x_trigger) |
| 443 | return x_trigger |
| 444 | |
| 445 | |
| 446 | class SingleTargetTrans: |
nothing calls this directly
no outgoing calls
no test coverage detected