Upsample3DLayer<T>

Layers · AiDotNet.NeuralNetworks.Layers

Represents a 3D upsampling layer that increases the spatial dimensions of volumetric data using nearest-neighbor interpolation.

Inheritance: LayerBase<T> → Upsample3DLayer<T>

Implements: IShapeContract

For Beginners

This layer makes 3D volumes larger by simply repeating voxel values.

Think of it like zooming in on a 3D image:

  • When you zoom in on a voxelized object, each original voxel becomes a larger block
  • This layer does the same thing to 3D feature volumes inside the neural network
  • It’s like stretching a 3D volume without adding any new information

For example, with a scale factor of 2:

  • A 4×4×4 volume becomes an 8×8×8 volume
  • Each voxel in the original volume is copied to a 2×2×2 block in the output
  • This creates a larger volume that preserves the original content but with more voxels

This is essential for 3D U-Net decoder paths, where we need to progressively increase the spatial resolution to match the original input size.

How It Works

A 3D upsampling layer increases the spatial dimensions (depth, height, width) of volumetric tensors by repeating values from the input to create a larger output. This implementation uses nearest-neighbor interpolation, which copies each voxel value to fill a block in the output based on the scale factors.

Constructors

Constructor Summary
Upsample3DLayer(int scaleDepth, int scaleHeight, int scaleWidth) Initializes a new instance of the Upsample3DLayer class with separate scale factors.
Upsample3DLayer(int scaleFactor) Initializes a new instance of the Upsample3DLayer class with uniform scaling.

Properties

Property Summary
bool SupportsTraining { get; } Gets a value indicating whether this layer supports training.
int ScaleDepth { get; } Gets the scale factor for the depth dimension.
int ScaleHeight { get; } Gets the scale factor for the height dimension.
int ScaleWidth { get; } Gets the scale factor for the width dimension.

Methods

Method Summary
IReadOnlyList<OutputAxisContract> OutputAxesFor(int inputRank)
Upsample3DLayer<T> DeserializeFrom(BinaryReader reader) Creates a new Upsample3DLayer instance from serialized data.
void ResetState() Resets the cached state from forward/backward passes.