feat: add layers for CNNs
This commit is contained in:
+21
-1
@@ -139,10 +139,30 @@ public:
|
||||
return res;
|
||||
}
|
||||
public:
|
||||
T* data() { return m_items; }
|
||||
template <typename Func>
|
||||
mat& apply(Func&& func) {
|
||||
for (auto& el : *this)
|
||||
el = func(el);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename Func>
|
||||
mat& apply(const mat& rhs, Func&& func) {
|
||||
for (auto it = begin(), itR = rhs.begin(); it != end(); ++it, ++itR)
|
||||
*it = func(*it, *itR);
|
||||
return *this;
|
||||
}
|
||||
public:
|
||||
T* data() { return m_items; }
|
||||
const T* data() const { return m_items; }
|
||||
|
||||
T* begin() { return m_items; }
|
||||
T* end() { return m_items + size(); }
|
||||
const T* begin() const { return m_items; }
|
||||
const T* end() const { return m_items + size(); }
|
||||
const T* cbegin() const { return begin(); }
|
||||
const T* cend() const { return end(); }
|
||||
|
||||
constexpr std::size_t size() const { return M * N; }
|
||||
public:
|
||||
bool operator==(const mat& rhs) const { return std::memcmp(m_items, rhs.m_items, sizeof(m_items)) == 0; }
|
||||
|
||||
Reference in New Issue
Block a user