-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f571077
commit 9f42e0c
Showing
14 changed files
with
1,136 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 16 additions & 1 deletion
17
src/components/sscma-micro/sscma/core/math/ma_math_vectors.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,30 @@ | ||
#ifndef _MA_MATH_VECTORS_H_ | ||
#define _MA_MATH_VECTORS_H_ | ||
|
||
#include <cstdint> | ||
#include <cstddef> | ||
#include <cstdint> | ||
|
||
#if MA_USE_LIB_XTENSOR | ||
#include <xtensor/xarray.hpp> | ||
#include <xtensor/xmath.hpp> | ||
#include <xtensor/xview.hpp> | ||
#endif | ||
|
||
namespace ma::math { | ||
|
||
void softmax(float* data, size_t size); | ||
|
||
void fastSoftmax(float* data, size_t size); | ||
|
||
#if MA_USE_LIB_XTENSOR | ||
template <typename QT> | ||
static void dequantizeValues1D(xt::xarray<float>& dequantized_outputs, int index, const xt::xarray<QT>& quantized_outputs, size_t dim1, float32_t qp_scale, float32_t qp_zp) { | ||
for (size_t i = 0; i < dim1; ++i) { | ||
dequantized_outputs(i) = (float(quantized_outputs(index, i)) - qp_zp) * qp_scale; | ||
} | ||
} | ||
#endif | ||
|
||
} // namespace ma::math | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.