Neural Network
Started on implementing neural network from NNFS. I've done ReLU and stopped at p.104. Softmax is not ready.
This commit is contained in:
@@ -17,6 +17,35 @@ namespace numerics{
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void inplace_max(utils::Matrix<T>& A, const T b){
|
||||
|
||||
const uint64_t rows = A.rows();
|
||||
const uint64_t cols = A.cols();
|
||||
|
||||
for (uint64_t i = 0; i < rows; ++i){
|
||||
for (uint64_t j = 0; j < cols; ++j){
|
||||
|
||||
if (b > A(i,j)){
|
||||
//std::cout << A(i,j) << std::endl;
|
||||
A(i,j) = b;
|
||||
//std::cout << A(i,j) << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
utils::Matrix<T> max(const utils::Matrix<T>& A, const T b){
|
||||
|
||||
utils::Matrix<T> B = A;
|
||||
|
||||
inplace_max(B, b);
|
||||
|
||||
|
||||
return B;
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // namespace numerics
|
||||
|
||||
Reference in New Issue
Block a user