Done with activation softmax backwards

This commit is contained in:
2026-07-31 19:08:57 +02:00
parent d7b74ab40f
commit 11da534fd6
30 changed files with 3029 additions and 184 deletions
+18 -18
View File
@@ -24,11 +24,11 @@
* Module Name: math
* File Name: log.cpp
* Revision: 0.1.0
* Date: 29-07-2026
* Date: 31-07-2026
* Author: Michelle Bausager
*
* Description:
* Functions to calculate the logorithem of numbers
* Functions to calculate the natural logorithem of numbers
*
*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
#pragma once
@@ -42,30 +42,30 @@ namespace math{
/**
* @brief calculates the exponential of a value.
* @brief calculates the log of a value.
*
* Computes:
* @code
* result = exp(k)
* result = log(k)
* @endcode
*
* @tparam T Numeric element type.
* @param k Value to take the exp of.
* @param x Value to take the log of.
*
* @return The calculated value
*
* @note This function is omp-friendly.
*/
template <typename T>
T exp(const T x);
T log(const T x);
/**
* @brief Calculates the exponential elementwise in a vector
* @brief Calculates the natrual logorithmic elementwise in a vector
*
* Computes:
* @code
* c[i] = exp(a[i])
* c[i] = log(a[i])
* @endcode
*
* @tparam T Numeric element type.
@@ -79,14 +79,14 @@ T exp(const T x);
* unnecessary temporary allocations.
*/
template <typename T>
bool exp(const panic::tensor::vector<T>& a, panic::tensor::vector<T>& c);
bool log(const panic::tensor::vector<T>& a, panic::tensor::vector<T>& c);
/**
* @brief Calculates the exponential elementwise in a vector
* @brief Calculates the natrual log elementwise in a vector
*
* Computes:
* @code
* result[i] = exp(a[i])
* result[i] = log(a[i])
* @endcode
*
* @tparam T Numeric element type.
@@ -98,14 +98,14 @@ bool exp(const panic::tensor::vector<T>& a, panic::tensor::vector<T>& c);
* @note This overload is convenient, but may allocate a new vector.
*/
template <typename T>
panic::tensor::vector<T> add(const panic::tensor::vector<T>& a);
panic::tensor::vector<T> log(const panic::tensor::vector<T>& a);
/**
* @brief Calculates the expnential elementwise of a matrix
* @brief Calculates the natrual log elementwise of a matrix
*
* Computes:
* @code
* C(i,j) = exp(A(i,j))
* C(i,j) = log(A(i,j))
* @endcode
*
* @tparam T Numeric element type.
@@ -119,14 +119,14 @@ panic::tensor::vector<T> add(const panic::tensor::vector<T>& a);
* unnecessary temporary allocations.
*/
template <typename T>
bool exp(const panic::tensor::matrix<T>& A, panic::tensor::matrix<T>& C);
bool log(const panic::tensor::matrix<T>& A, panic::tensor::matrix<T>& C);
/**
* @brief Returns the calculated ecponential elementwise of the matrix
* @brief Returns the calculated natrual log elementwise of the matrix
*
* Computes:
* @code
* result(i,j) = exp(A(i,j))
* result(i,j) = log(A(i,j))
* @endcode
*
* @tparam T Numeric element type.
@@ -138,7 +138,7 @@ bool exp(const panic::tensor::matrix<T>& A, panic::tensor::matrix<T>& C);
* @note This overload is convenient, but may allocate a new vector.
*/
template <typename T>
panic::tensor::matrix<T> exp(const panic::tensor::matrix<T>& A);
panic::tensor::matrix<T> log(const panic::tensor::matrix<T>& A);
} // namespace math
} // namespace panic