0234315776751221ef9da5d2073e32f9f54c01bb,kornia/color/yuv.py,,rgb_to_yuv,#Any#,35

Before Change


    Returns:
        torch.Tensor: YUV version of the image.
    See :class:`~kornia.color.RgbToYuv` for details.
    if not torch.is_tensor(input):
        raise TypeError("Input type is not a torch.Tensor. Got {type(input)}")

    if not(len(input.shape) == 3 or len(input.shape) == 4):
        raise ValueError(f"Input size must have a shape of (*, 3, H, W) or (3, H, W). Got {input.shape}")

    if input.shape[-3] != 3:
        raise ValueError(f"Expected input to have 3 channels, got {input.shape[-3]}")

    r, g, b = torch.chunk(input, chunks=3, dim=-3)
    y: torch.Tensor = 0.299 * r + 0.587 * g + 0.114 * b
    u: torch.Tensor = -0.147 * r - 0.289 * g + 0.436 * b
    v: torch.Tensor = 0.615 * r - 0.515 * g - 0.100 * b
    yuv_img: torch.Tensor = torch.cat((y, u, v), -3)
    return yuv_img

After Change


    u: torch.Tensor = -0.147 * r - 0.289 * g + 0.436 * b
    v: torch.Tensor = 0.615 * r - 0.515 * g - 0.100 * b

    out: torch.Tensor = torch.cat([y, u, v], -3)

    return out
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 10

Instances


Project Name: arraiy/torchgeometry
Commit Name: 0234315776751221ef9da5d2073e32f9f54c01bb
Time: 2020-11-01
Author: edgar.riba@gmail.com
File Name: kornia/color/yuv.py
Class Name:
Method Name: rgb_to_yuv


Project Name: arraiy/torchgeometry
Commit Name: ab9c4f8474ca744c7e67822fa21d408d0b0ae2d0
Time: 2020-04-18
Author: sj8716643@126.com
File Name: kornia/augmentation/functional.py
Class Name:
Method Name: apply_rotation


Project Name: arraiy/torchgeometry
Commit Name: 0234315776751221ef9da5d2073e32f9f54c01bb
Time: 2020-11-01
Author: edgar.riba@gmail.com
File Name: kornia/color/yuv.py
Class Name:
Method Name: yuv_to_rgb