torch.nn.ReplicationPad3d
class ReplicationPad3d extends Modulenew ReplicationPad3d(padding: Padding3D)
- readonly
padding([number, number, number, number, number, number])
3D replication padding: pads volumes by repeating surface voxels.
Extends 3D data by replicating surface voxel values on all six faces. Simpler alternative to reflection for volumetric data.
When to use ReplicationPad3d:
- Simple padding for 3D volumes
- Medical imaging (when edge replication acceptable)
- Performance-critical 3D processing
- Avoiding boundary artifacts without reflection complexity
- Surface replication: All 6 faces replicate outward
- Simple and fast: Straightforward voxel duplication
Examples
// 3D volume replication
const pad = new torch.nn.ReplicationPad3d(1);
const vol = torch.randn([8, 3, 64, 64, 64]);
const padded = pad.forward(vol); // [8, 3, 66, 66, 66]