def rgb2gray(x):
    """
    x_shape: (B, C, H, W)
    C: RGB
    weighted grayscale by luminosity: 0.3*R + 0.59*G + 0.11*B
    """
    return 0.3 * x[:, 0, ...] + 0.59 * x[:, 1, ...] + 0.11 * x[:, 2, ...]