Making loss_categorical_crossentropy
This commit is contained in:
@@ -702,6 +702,106 @@ panic::tensor::matrix<T> clip_higher_colwise(const panic::tensor::matrix<T>& A,
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Clips values in the vector or scalar.
|
||||
*
|
||||
* Computes:
|
||||
* @code
|
||||
|
||||
* @endcode
|
||||
*
|
||||
* @tparam T Numeric element type.
|
||||
* @param a Input vector.
|
||||
* @param lower Scalar value compared to each element of @p a.
|
||||
* @param higher Scalar value compared to each element of @p a.
|
||||
* @param c Output vector. Resized to match @p a.
|
||||
*
|
||||
* @return true if @p c was resized and filled successfully.
|
||||
* @return false if resizing @p c failed.
|
||||
*
|
||||
* @note This overload writes the result into an existing vector to avoid
|
||||
* unnecessary temporary allocations.
|
||||
*/
|
||||
template <typename T>
|
||||
bool clip(const panic::tensor::vector<T>& a, const T lower, const T higher, const panic::tensor::vector<T>& c);
|
||||
|
||||
/**
|
||||
* @brief Returns a cliped value in the vector.
|
||||
*
|
||||
* Computes:
|
||||
* @code
|
||||
* @endcode
|
||||
*
|
||||
* @tparam T Numeric element type.
|
||||
* @param a Input vector.
|
||||
* @param lower Scalar value compared to each element of @p a.
|
||||
* @param higher Scalar value compared to each element of @p a.
|
||||
*
|
||||
* @return A new vector containing the result.
|
||||
* @return An empty vector if the operation fails.
|
||||
*
|
||||
* @note This overload is convenient, but may allocate a new vector.
|
||||
*/
|
||||
template <typename T>
|
||||
panic::tensor::vector<T> clip(const panic::tensor::vector<T>& a, const T lower, const T higher);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Clips the elementwise in the matrix.
|
||||
*
|
||||
* Computes:
|
||||
* @code
|
||||
* @endcode
|
||||
*
|
||||
* @tparam T Numeric element type.
|
||||
* @param A Input matrix.
|
||||
* @param lower Scalar value compared to each element of @p a.
|
||||
* @param higher Scalar value compared to each element of @p a.
|
||||
* @param C Output Matrix. Resized to match @p A.
|
||||
*
|
||||
* @return true if @p C was resized and filled successfully.
|
||||
* @return false if resizing @p C failed.
|
||||
*
|
||||
* @note This overload writes the result into an existing matrix to avoid
|
||||
* unnecessary temporary allocations.
|
||||
*/
|
||||
template <typename T>
|
||||
bool clip(const panic::tensor::matrix<T>& A, const T lower, const T higher, panic::tensor::matrix<T>& C);
|
||||
|
||||
/**
|
||||
* @brief Returns a new matrix containing the cliped min elementwise in the matrix.
|
||||
*
|
||||
* Computes:
|
||||
* @code
|
||||
* @endcode
|
||||
*
|
||||
* @tparam T Numeric element type.
|
||||
* @param A Input matrix.
|
||||
* @param lower Scalar value compared to each element of @p a.
|
||||
* @param higher Scalar value compared to each element of @p a.
|
||||
*
|
||||
* @return A new matrix containing the result.
|
||||
* @return An empty matrix if the operation fails.
|
||||
*
|
||||
* @note This overload is convenient, but may allocate a new matrix.
|
||||
*/
|
||||
template <typename T>
|
||||
panic::tensor::matrix<T> clip(const panic::tensor::matrix<T>& A, const T lower, const T higher);
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user