CroppingLayer<T>
Layers ยท AiDotNet.NeuralNetworks.Layers
Represents a cropping layer that removes portions of input tensors from the edges.
Inheritance: LayerBase<T> โ CroppingLayer<T>
Implements: IShapeContract
For Beginners
A cropping layer cuts off the edges of your data.
Think of it like cropping a photo:
- You can trim different amounts from the top, bottom, left, and right
- The middle portion (the important part) is kept
- The trimmed edges are discarded
For example, in image processing:
- You might crop off padding added by previous layers
- You might focus on the central region where the important features are
- You might adjust the size to match what the next layer expects
Cropping layers are simple but useful for controlling exactly what part of the data flows through your neural network.
How It Works
A cropping layer removes specified portions from the edges of an input tensor. This is useful for removing border artifacts, adjusting dimensions between layers, or focusing on specific regions of input data. The cropping can be applied differently to each dimension of the input.
Constructors
| Constructor | Summary |
|---|---|
CroppingLayer(int[] cropTop, int[] cropBottom, int[] cropLeft, int[] cropRight, IActivationFunction<T> scalarActivation, IEngine engine) |
Initializes a new instance of the CroppingLayer class with the specified cropping parameters and a vector activation function. |
CroppingLayer(int[] cropTop, int[] cropBottom, int[] cropLeft, int[] cropRight, IVectorActivationFunction<T> vectorActivation, IEngine engine) |
Initializes a new instance of the CroppingLayer class with the specified cropping parameters and a vector activation function. |
Properties
| Property | Summary |
|---|---|
bool SupportsGpuTraining { get; } |
|
bool SupportsTraining { get; } |
Gets a value indicating whether this layer supports training through backpropagation. |
Methods
| Method | Summary |
|---|---|
IReadOnlyList<OutputAxisContract> OutputAxesFor(int inputRank) |
|
void ResetState() |
Resets the internal state of the layer. |