def add_noise
函数功能
在原始样本中添加噪声。
函数原型
def add_noise(self, original_samples: torch.Tensor, noise: torch.Tensor, timesteps: torch.Tensor) -> torch.Tensor:
参数说明
参数名 |
输入/输出 |
类型 |
说明 |
---|---|---|---|
original_samples |
输入 |
torch.Tensor |
原始样本张量,必须为5维输入。 |
noise |
输入 |
torch.Tensor |
噪声张量,必须为5维输入。 |
timesteps |
输入 |
torch.Tensor |
时间步张量,必须为1维输入。 |
返回值说明
返回添加噪声后的结果。