bdd3f2f8f306000f9b0c34e0ec2a86a75cee885b,kornia/feature/laf.py,,ellipse_to_laf,#Any#,193

Before Change


            "ellipse shape should be must be [BxNx5]. "
            "Got {}".format(ells.size()))

    ell_shape = torch.cat([torch.cat([ells[..., 2:3], ells[..., 3:4]], dim=2).unsqueeze(2),
                           torch.cat([ells[..., 3:4], ells[..., 4:5]], dim=2).unsqueeze(2)], dim=2).view(-1, 2, 2)
    out = torch.matrix_power(torch.cholesky(ell_shape, False), -1).view(B, N, 2, 2)
    out = torch.cat([out, ells[..., :2].view(B, N, 2, 1)], dim=3)
    return out

After Change


    // https://en.wikipedia.org/wiki/Square_root_of_a_2_by_2_matrix
    // M = (A 0; C D)
    // R = (sqrt(A) 0; C / (sqrt(A)+sqrt(D)) sqrt(D))
    a11 = ells[..., 2:3].abs().sqrt()
    a12 = torch.zeros_like(a11)
    a22 = ells[..., 4:5].abs().sqrt()
    a21 = ells[..., 3:4] / (a11 + a22).clamp(1e-9)
    A = torch.stack([a11, a12, a21, a22], dim=-1).view(B, N, 2, 2).inverse()
    out = torch.cat([A, ells[..., :2].view(B, N, 2, 1)], dim=3)
    return out
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: arraiy/torchgeometry
Commit Name: bdd3f2f8f306000f9b0c34e0ec2a86a75cee885b
Time: 2020-04-29
Author: ducha.aiki@gmail.com
File Name: kornia/feature/laf.py
Class Name:
Method Name: ellipse_to_laf


Project Name: rusty1s/pytorch_geometric
Commit Name: 534a10d60d3c5a356c8121f9b3c53f49cf873f96
Time: 2019-12-06
Author: matthias.fey@tu-dortmund.de
File Name: torch_geometric/transforms/gdc.py
Class Name: GDC
Method Name: diffusion_matrix_approx


Project Name: r9y9/wavenet_vocoder
Commit Name: 90163e28710cb299adcd277a3931872e0a2a44cc
Time: 2019-08-25
Author: zryuichi@gmail.com
File Name: wavenet_vocoder/wavenet.py
Class Name: WaveNet
Method Name: forward