MCPcopy Create free account
hub / github.com/LBANN/lbann / SelectImplIfTrue

Class SelectImplIfTrue

src/operators/math/select.cpp:65–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63
64template <typename DataT>
65struct SelectImplIfTrue
66{
67 DataT m_value, m_epsilon, m_iftrue;
68 SelectImplIfTrue(DataT const& value,
69 DataT const& epsilon,
70 DataT const& iftrue)
71 : m_value(value), m_epsilon(epsilon), m_iftrue(iftrue)
72 {}
73
74 DataT operator()(DataT const& predicate, DataT const& iffalse) const noexcept
75 {
76 bool istrue = std::fabs(predicate - m_value) < m_epsilon;
77 return istrue ? m_iftrue : iffalse;
78 }
79 void operator()(DataT const& predicate,
80 DataT const& iffalse,
81 DataT const& dy,
82 DataT& dpredicate,
83 DataT& diffalse) const noexcept
84 {
85 bool istrue = std::fabs(predicate - m_value) < m_epsilon;
86 diffalse = istrue ? El::TypeTraits<DataT>::Zero() : dy;
87 dpredicate = El::TypeTraits<DataT>::Zero();
88 }
89};
90
91template <typename DataT>
92struct SelectImplIfFalse

Callers 2

fp_compute_localMethod · 0.85
bp_compute_localMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected