import torch

def in1k_timm(x, mean=(0.485, 0.456, 0.406), std=(0.229, 0.224, 0.225),):
    """Re-normalize from [-1,1] to ImageNet mean/std.

    Input:  (..., C, H, W) float in [-1, 1]
    Output: (..., C, H, W) float32
    """
    x = (x + 1.0) / 2.0  # [-1,1] -> [0,1]
    mean = torch.tensor(mean, dtype=torch.float32, device=x.device).view(-1, 1, 1)
    std = torch.tensor(std, dtype=torch.float32, device=x.device).view(-1, 1, 1)
    return (x - mean) / std
