pad

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

pad
(,
size_t[] before
,
size_t[] after
,
string mod = __MODULE__
,
size_t line = __LINE__
)

Parameters

input Operation

The operation that should be padded.

before size_t[]

The amount of padding that should be prepended for each dimension.

after size_t[]

The amount of padding that should be appended for each dimension.

Return Value

Type: Operation

The new Operation.

Examples

import dopt.core : evaluate;

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

assert(p1.evaluate().get!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
]);

Meta