Function pad

Pads the result of an operation with zeros in each dimension.

Operation pad (
  Operation input,
  ulong[] before,
  ulong[] after,
  string mod = __MODULE__,
  ulong line = cast(ulong)__LINE__
);

Parameters

NameDescription
input The operation that should be padded.
before The amount of padding that should be prepended for each dimension.
after The amount of padding that should be appended for each dimension.

Returns

The new Operation.

Example

import dopt.core : evaluate;

auto p1 = int32([1, 1], [3]).pad([2, 1], [3, 3]);

assert(p1.evaluate().as!int == [
    0, 0, 0, 0, 0,
    0, 0, 0, 0, 0,
    0, 3, 0, 0, 0,
    0, 0, 0, 0, 0,
    0, 0, 0, 0, 0,
    0, 0, 0, 0, 0
]);