Starting on the model.h, but need to make layer structs and structs for loss and optimizers
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
#pragma once
|
||||
|
||||
#include "./core/omp_config.h"
|
||||
#include "detail/sign_serial.h"
|
||||
|
||||
|
||||
namespace numerics{
|
||||
|
||||
// ---------------- Elementwise ----------------
|
||||
template <typename T>
|
||||
inline void inplace_sign(T& c) {
|
||||
detail::inplace_sign_serial(c);
|
||||
}
|
||||
template <typename T>
|
||||
inline T sign(const T c) {
|
||||
T out = c;
|
||||
inplace_sign(out);
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
|
||||
template <typename T>
|
||||
inline void inplace_sign(utils::Vector<T>& v) {
|
||||
detail::inplace_sign_serial(v);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline utils::Vector<T> sign(const utils::Vector<T>& v) {
|
||||
utils::Vector<T> out = v;
|
||||
inplace_sign(out);
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename T>
|
||||
inline void inplace_sign(utils::Matrix<T>& A) {
|
||||
detail::inplace_sign_serial(A);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline utils::Matrix<T> sign(const utils::Matrix<T>& A) {
|
||||
utils::Matrix<T> out = A;
|
||||
inplace_sign(out);
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user