MCPcopy Create free account
hub / github.com/TrustAIResearch/MLHospital / __call__

Method __call__

mlh/data_preprocessing/data_loader.py:433–443  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

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
446class SingleTargetTrans:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected