ActivationLayer<T>
Layers · AiDotNet.NeuralNetworks.Layers
A layer that applies an activation function to transform the input data.
Activation functions introduce non-linearity to neural networks. Non-linearity means the output isn’t simply proportional to the input (like y = 2x). Instead, it can follow curves or more complex patterns. severely limiting what it can learn.
Common activation functions include:
- ReLU: Returns 0 for negative inputs, or the input value for positive inputs
- Sigmoid: Squashes values between 0 and 1, useful for probabilities
- Tanh: Similar to sigmoid but outputs values between -1 and 1
Inheritance: LayerBase<T> → ActivationLayer<T>
Implements: IShapeContract
Constructors
| Constructor | Summary |
|---|---|
ActivationLayer(IActivationFunction<T> activationFunction) |
Creates a new activation layer that applies a vector activation function to the entire tensor at once. |
ActivationLayer(IVectorActivationFunction<T> vectorActivationFunction) |
Creates a new activation layer that applies a vector activation function to the entire tensor at once. |
Properties
| Property | Summary |
|---|---|
bool SupportsTraining { get; } |
Indicates whether this layer has trainable parameters. |
Methods
| Method | Summary |
|---|---|
IReadOnlyList<OutputAxisContract> OutputAxesFor(int inputRank) |
Derived from this type’s [TensorLayout] declarations. |
OnnxLayerOutputs ConvertToOnnx(OnnxGraphBuilder builder, OnnxLayerInputs inputs) |
Emits a single ONNX op corresponding to the layer’s activation function. |
void ResetState() |
Clears the layer’s memory of previous inputs. |