Convert the range from [-1, 1] to [0, 1].
(self, x)
| 121 | self.d_optimizer.zero_grad() |
| 122 | |
| 123 | def denorm(self, x): |
| 124 | """Convert the range from [-1, 1] to [0, 1].""" |
| 125 | out = (x + 1) / 2 |
| 126 | return out.clamp_(0, 1) |
| 127 | |
| 128 | def gradient_penalty(self, y, x): |
| 129 | """Compute gradient penalty: (L2_norm(dy/dx) - 1)**2.""" |
no outgoing calls