ConstantPad3d#
- class brainstate.nn.ConstantPad3d(padding, value=0, in_size=None, name=None)[source]#
Pads the input tensor with a constant value.
- 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)
value (
float) – The constant value to use for padding. Default is 0.in_size (
int|Sequence[int] |integer|Sequence[integer] |None) – The input size.
Examples
>>> import brainstate as brainstate >>> import jax.numpy as jnp >>> pad = brainstate.nn.ConstantPad3d(1, value=3.5) >>> input = jnp.ones((1, 4, 4, 4, 3)) >>> output = pad(input) >>> print(output.shape) (1, 6, 6, 6, 3)