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

Function encoder

transferattack/generation/diffattack.py:360–365  ·  view source on GitHub ↗
(image, model, res=512)

Source from the content-addressed store, hash-verified

358
359
360def encoder(image, model, res=512):
361 generator = torch.Generator().manual_seed(8888)
362 image = preprocess(image, res)
363 gpu_generator = torch.Generator(device=image.device)
364 gpu_generator.manual_seed(generator.initial_seed())
365 return 0.18215 * model.vae.encode(image).latent_dist.sample(generator=gpu_generator)
366
367
368@torch.no_grad()

Callers 1

ddim_reverse_sampleFunction · 0.85

Calls 2

preprocessFunction · 0.85
sampleMethod · 0.45

Tested by

no test coverage detected