(a, b, s)
| 217 | |
| 218 | @torch.no_grad() |
| 219 | def diff_step(a, b, s): |
| 220 | n = torch.linalg.matrix_norm(a, keepdim=True) |
| 221 | x = a.div(n) |
| 222 | y = b.div(torch.linalg.matrix_norm(b, keepdim=True)) |
| 223 | y = n * y.sub(x.mul(torch.mul(x, y).sum().clamp(min=-1.0, max=1.0))) |
| 224 | return a - y * s |
| 225 | |
| 226 | def perp_step_wrap(s=0.5): |
| 227 | @torch.no_grad() |
no outgoing calls
no test coverage detected