bitorch.layers.pad.PadModule

class bitorch.layers.pad.PadModule(padding_left: int = 0, padding_right: int = 0, padding_top: int = 0, padding_bottom: int = 0, padding_value: int = 0)[source]

Module for padding tensors.

Methods

__init__

initialization function for padding.

forward

Defines the computation performed at every call.

Attributes

__init__(padding_left: int = 0, padding_right: int = 0, padding_top: int = 0, padding_bottom: int = 0, padding_value: int = 0)[source]

initialization function for padding.

Parameters:
  • padding_left (int, optional) – number of columns to pad to the left.

  • padding_right (int, optional) – number of columns to pad to the right.

  • padding_top (int, optional) – number of rows to pad at the top.

  • padding_bottom (int, optional) – number of rows to pad at the bottom.

  • padding_value (float, optional) – fill value used for padding.

forward(x: Tensor) Tensor[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.