Fork me on GitHub
Arraymancer Technical reference Tutorial Spellbook (How-To's) Under the hood

Module maxpool2D


MaxPool2DGate[TT] = ref object of Gate[TT]
  cached_input_shape: MetadataArray
  cached_max_indices: Tensor[int]
  kernel, padding, stride: Size2D
  Source Edit


proc maxpool2d[TT](input: Variable[TT]; kernel: Size2D; padding: Size2D = (0, 0);
                  stride: Size2D = (1, 1)): Variable[TT] {.
  • input Variable wrapping a 4D Tensor shape [N,C,H_in,W_in]
  • kernel Height (kH) and width (kW) of the pooling kernel.
  • padding Size2D tuple with height and width of the padding
  • stride Size2D tuple with height and width of the stride
  • A variable with a pooled 4D Tensor of shape [N,C,H_out,W_out], where
    H_out = (H_in + (2*padding.height) - kH) / stride.height + 1 W_out = (W_in + (2*padding.width) - kW) / stride.width + 1
Warning ⚠:
  • Experimental, there is no tests yet for this layer
  Source Edit


method forward[TT](self: MaxPool2DGate[TT]; a: Variable[TT]): Variable[TT] {.
inline, locks: 0
  Source Edit
method backward[TT](self: MaxPool2DGate[TT]; gradient: TT): SmallDiffs[TT] {.
noInit, inline, locks: 0
  Source Edit