CircularPad3d

Contents

CircularPad3d#

class brainstate.nn.CircularPad3d(padding, in_size=None, name=None)[source]#

Pads the input tensor using circular padding (wrap around).

Parameters:
  • padding (int | Sequence[int]) –

    The size of the padding. Can be:

    • int: same padding for all sides

    • Sequence[int] of length 3: (depth_pad, height_pad, width_pad)

    • Sequence[int] of length 6: (left, right, top, bottom, front, back)

  • in_size (int | Sequence[int] | integer | Sequence[integer] | None) – The input size.

  • name (str | None) – The name of the module.

Examples

>>> import brainstate as brainstate
>>> import jax.numpy as jnp
>>> pad = brainstate.nn.CircularPad3d(1)
>>> input = jnp.ones((1, 4, 4, 4, 3))
>>> output = pad(input)
>>> print(output.shape)
(1, 6, 6, 6, 3)