pad(array, border, pad_amount)
pad(array, border, left_pad_amount, right_pad_amount)
pad(array, border, pad_amounts_for_dims)
pad(array, border, left_pad_amount_for_dims, right_pad_amount_for_dims)

Pads arrays of any dimension with various border options including constants, periodic, replicate, symmetric, mirror and smooth. Can control amount of padding applied to the left and right side of each dimension. Fully differentiable (compatible with Zygote.jl Flux.jl)

Border options

  • :periodic: a b c | a b
  • :symmetric: a b c | c b
  • :mirror: a b c | b a
  • replicate: a b c | c c
  • :smooth: a b c | 2c-b (Maintains C1 continuity)
  • any other value v: a b c | v