def space_to_depth(input_t, size):
    """
    Transpose spatial space to channel space

     size   int >= 2
            spatial axes must be divisible by size
    """

    N,C,H,W = input_t.shape
    if size < 2:
        raise ValueError('size should be >= 2')
    if H % size != 0:
        raise ValueError(f'Unable to divide {H} H by {size} !')
    if W % size != 0:
        raise ValueError(f'Unable to divide {W} W by {size} !')

    OH, OW = H // size, W // size

    return (input_t.reshape  ( (N, C, OH, size, OW, size) )
                   .transpose( (0, 3, 5, 1, 2, 4) )
                   .reshape  ( (N, (size*size) * C, OH, OW) ))