Skip to article frontmatterSkip to article content

In this example, we are applying 2x2 patches with a stride of 2. The resulting image will transform this into a checkboard pattern of 00, 01, 10, 11.

# initialize kernel
kernel: Array["H W Cin Cout"] = zeros((H, W, Cin, Cout))
kernel[0,0,0,0] = 1
kernel[0,0,0,1] = 1
kernel[0,0,0,2] = 1
kernel[0,0,0,3] = 1

Haar Matrix

# initialize kernel
kernel: Array["H W"] = ones((H, W,))
kernel[1,1] = -1

Resources

Haar Matrix Wikipedia