Activation Softmax Forward done
This commit is contained in:
@@ -0,0 +1,94 @@
|
||||
/**++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
*
|
||||
* PANIC
|
||||
* Portable Algorithms and Numerics In C++
|
||||
*
|
||||
* Scientific computing from scratch, with feeling.
|
||||
*
|
||||
* Copyright (c) 2026 Michelle Bausager
|
||||
*
|
||||
* This file is part of PANIC.
|
||||
*
|
||||
* PANIC is free software licensed under the GNU General Public License v3.0 or later.
|
||||
* You may redistribute and/or modify it under the terms of the GPL.
|
||||
*
|
||||
* PANIC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the LICENSE file for the full license text.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*
|
||||
*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
*
|
||||
* Project Name: PANIC
|
||||
* Module Name: neural_network
|
||||
* File Name: activation_softmax.hpp
|
||||
* Revision: 0.1.0
|
||||
* Date: 29-08-2026
|
||||
* Author: Michelle Bausager
|
||||
*
|
||||
* Description:
|
||||
* Defines the activation layer for Softmax
|
||||
*
|
||||
*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
|
||||
#pragma once
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------------
|
||||
// INCLUDE DESCRIPTION
|
||||
//---------------------------------------------------------------------------------------------------------------------------
|
||||
#include <config/types.hpp> // panic::uint_t, panic::int_t, and panic::real_t
|
||||
#include <neural_network/layer/layer.hpp> // for base layer struct
|
||||
|
||||
#include <tensor/matrix.hpp>
|
||||
|
||||
|
||||
namespace panic{
|
||||
namespace neural_network{
|
||||
|
||||
/**
|
||||
* @brief struct for softmax activation layer used in neural networks
|
||||
*
|
||||
* Computes:
|
||||
* @code
|
||||
* panic::neural_network::activation_softmax myactivation();
|
||||
* myactivation.forward(inputMatrix);
|
||||
* @endcode
|
||||
*
|
||||
* The struct is used in PANIC nural_network library.
|
||||
*/
|
||||
struct activation_softmax : public layer{
|
||||
|
||||
/**
|
||||
* @brief Empthy constructor
|
||||
*
|
||||
*/
|
||||
activation_softmax();
|
||||
|
||||
/**
|
||||
* @brief Default de-constructor
|
||||
*
|
||||
*/
|
||||
~activation_softmax() = default;
|
||||
|
||||
/**
|
||||
* @brief Forward function for layer
|
||||
*
|
||||
* @param inputs Data input for forward pass.
|
||||
*
|
||||
* @Note Calculates -> outputs = inputs * weights + biases
|
||||
*/
|
||||
bool forward(const panic::tensor::real_matrix& inputs);
|
||||
|
||||
/**
|
||||
* @brief Backward function for layer
|
||||
*
|
||||
* @param inputs Data input for bacward pass.
|
||||
*
|
||||
* @Note Calculates derivative of forward function.
|
||||
*/
|
||||
bool backward(const panic::tensor::real_matrix& dinpus);
|
||||
};
|
||||
|
||||
} // namespace tensor
|
||||
} // namespace panic
|
||||
|
||||
Reference in New Issue
Block a user