Skip to contents

z[i, j, k] = b[k] + sum_u sum_v sum_kp x[ip, jp, kp] w[u, v, kp, k] with ip = i * sh + u and jp = j * sw + v. This is a cross-correlation, as the book's own footnote 6 on p. 419 points out. Exported as morie_convlayer because morie_conv2d was already taken by R/gp_ch13_15.R.

Usage

morie_convlayer(x, kernel, bias = NULL, stride = c(1, 1), padding = c(0, 0))

Arguments

x

height by width by in-channels array

kernel

fh by fw by in-channels by out-channels array

bias

one entry per output feature map

stride

c(sh, sw)

padding

c(ph, pw) zero padding

Value

list(z, height, width, channels, total, maxz, nparams)

Examples

set.seed(1)
x <- array(rnorm(5 * 5 * 2), dim = c(5, 5, 2))
kernel <- array(rnorm(3 * 3 * 2 * 4), dim = c(3, 3, 2, 4))
z <- morie_convlayer(x, kernel)
dim(z)
#> NULL