I solve the problem…
I forgot to add .data  so that the gradient was ignored…
class Flip(nn.Module):
    def __init__(self, t, inplace=True):
        super(Flip, self).__init__()
        self.t = t
        self.inplace = inplace

    def forward(self, x):
        x = self.flip(x, self.t, self.inplace)
        return x

    @staticmethod
    def flip(x, t, inplace=True):
        if inplace:
            out = InplaceFlip.apply(x, t)
        else:
            # Input: (NT,C,H,W)
            nt, c, h, w = x.size()
            n = nt // t

            x = x.view(n, t, c, h, w)

            out = torch.zeros_like(x)
            
            # even
            out[:, 1::2] = x[:, 1::2]
            
            out = out.flip(2)

            out[:, 0::2] = x[:, 0::2]
            out = out.view(nt, c, h, w)
        return out


class InplaceFlip(torch.autograd.Function):
    @staticmethod
    def forward(ctx, x, t):
        ctx.t_ = t

        # Input: (NT,C,H,W)
        nt, c, h, w = x.size()
        n = nt // t

        x = x.view(n, t, c, h, w)

        buffer = x.data.new(n, t // 2, c, h, w).zero_()
        
        # even
        buffer = x[:, 1::2]
        
        buffer = buffer.flip(2)

        x[:, 1::2] = buffer
        x = x.view(nt, c, h, w)
        return x

    @staticmethod
    def backward(ctx, grad_output):
        t = ctx.t_

        # Input: (NT,C,H,W)
        nt, c, h, w = grad_output.size()
        n = nt // t

        grad_output = grad_output.view(n, t, c, h, w)

        buffer = grad_output.data.new(n, t // 2, c, h, w).zero_()
        
        # even
        buffer = grad_output[:, 1::2]
        
        buffer = buffer.flip(2)

        grad_output[:, 1::2] = buffer
        grad_output = grad_output.view(nt, c, h, w)
        return grad_output, None