Conv3DLayer<T>

Layers ยท AiDotNet.NeuralNetworks.Layers

Represents a 3D convolutional layer for processing volumetric data like voxel grids.

Inheritance: LayerBase<T> โ†’ Conv3DLayer<T>

Implements: IShapeContract

For Beginners

A 3D convolutional layer is like a 2D convolution but extended to work with volumetric data.

Think of it like examining a 3D cube of data:

  • A 2D convolution slides a filter across height and width
  • A 3D convolution slides a filter across depth, height, and width

This is useful for:

  • Recognizing 3D shapes from voxel grids (like ModelNet40)
  • Analyzing medical scans (CT, MRI)
  • Processing video frames as a 3D volume

The layer learns to detect 3D patterns like edges, surfaces, and volumes.

How It Works

A 3D convolutional layer applies learnable filters to volumetric input data to extract spatial features across all three dimensions. This is essential for processing 3D data such as voxelized point clouds, medical imaging (CT/MRI), or video sequences.

Constructors

Constructor Summary
Conv3DLayer(int outputChannels, int kernelSize, int stride, int padding, IActivationFunction<T> activationFunction) Initializes a new instance of the Conv3DLayer class with a vector activation function.
Conv3DLayer(int outputChannels, int kernelSize, int stride, int padding, IVectorActivationFunction<T> vectorActivationFunction) Initializes a new instance of the Conv3DLayer class with a vector activation function.

Properties

Property Summary
bool SupportsGpuTraining { get; } Gets a value indicating whether this layer supports GPU-resident training.
bool SupportsTraining { get; } Gets a value indicating whether this layer supports training (backpropagation).
int InputChannels { get; set; } Gets the number of input channels expected by this layer.
int KernelSize { get; set; } Gets the size of the 3D convolution kernel (same for depth, height, width).
int OutputChannels { get; set; } Gets the number of output channels (filters) produced by this layer.
int Padding { get; set; } Gets the zero-padding applied to all sides of the input volume.
int Stride { get; set; } Gets the stride of the convolution (step size when sliding the kernel).

Methods

Method Summary
Conv3DLayer<T> WithInputChannels(int inputChannels, int outputChannels, int kernelSize, int stride, int padding, IActivationFunction<T> activationFunction) Creates an allocation-free 3-D convolution whose channel dimensions are known at construction time.
Dictionary<string, string> GetParameterRoles() Returns parameter roles for per-role optimizer configuration (e.g., weight decay exemption for biases).
IReadOnlyList<OutputAxisContract> OutputAxesFor(int inputRank)
IReadOnlyList<Tensor<T>> GetTrainableParameters() Returns all trainable parameter tensors marked with [TrainableParameter].
Tensor<T> GetBiases() Gets the bias tensor.
Tensor<T> GetFilters() Gets the convolution filter kernels.
Tensor<T> GetWeights() Gets the kernel weights tensor.
void ClearGradients()
void ResetState() Resets the cached state from forward/backward passes.
void SetTrainableParameters(IReadOnlyList<Tensor<T>> parameters) Replaces trainable parameter tensors (e.g., with ParameterBuffer views).
void UpdateParameters(T learningRate) Updates the layer parameters using the computed gradients and learning rate.
void UpdateParametersGpu(IGpuOptimizerConfig config) Updates parameters on GPU using the configured optimizer.
void ZeroGrad() Clears all gradient fields discovered by convention ({paramName}Gradient).