代码拉取完成,页面将自动刷新
# https://github.com/chrisgoringe/cg-noise
import torch
def get_mixed_noise_function(original_noise_function, variation_seed, variation_weight):
def prepare_mixed_noise(latent_image:torch.Tensor, seed, batch_inds):
single_image_latent = latent_image[0].unsqueeze_(0)
different_noise = original_noise_function(single_image_latent, variation_seed, batch_inds)
original_noise = original_noise_function(single_image_latent, seed, batch_inds)
if latent_image.shape[0]==1:
mixed_noise = original_noise * (1.0-variation_weight) + different_noise * (variation_weight)
else:
mixed_noise = torch.empty_like(latent_image)
for i in range(latent_image.shape[0]):
mixed_noise[i] = original_noise * (1.0-variation_weight*i) + different_noise * (variation_weight*i)
return mixed_noise
return prepare_mixed_noise
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。