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
Type: Operation

The operation that should be padded.

before
Type: size_t[]

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

after
Type: size_t[]

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

Return Value

Type: Operation

The new Operation.

Examples

1 import dopt.core : evaluate;
2 
3 auto p1 = int32([1, 1], [3]).pad([2, 1], [3, 3]);
4 
5 assert(p1.evaluate().as!int == [
6     0, 0, 0, 0, 0,
7     0, 0, 0, 0, 0,
8     0, 3, 0, 0, 0,
9     0, 0, 0, 0, 0,
10     0, 0, 0, 0, 0,
11     0, 0, 0, 0, 0
12 ]);

Meta