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

Class SelectImplConstant

src/operators/math/select.cpp:119–138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

117
118template <typename DataT>
119struct SelectImplConstant
120{
121 DataT m_value, m_epsilon, m_iftrue, m_iffalse;
122 SelectImplConstant(DataT const& value,
123 DataT const& epsilon,
124 DataT const& iftrue,
125 DataT const& iffalse)
126 : m_value(value), m_epsilon(epsilon), m_iftrue(iftrue), m_iffalse(iffalse)
127 {}
128
129 DataT operator()(DataT const& predicate) const noexcept
130 {
131 bool istrue = std::fabs(predicate - m_value) < m_epsilon;
132 return istrue ? m_iftrue : m_iffalse;
133 }
134 DataT operator()(DataT const& predicate, DataT const& dy) const noexcept
135 {
136 return El::TypeTraits<DataT>::Zero();
137 }
138};
139
140template <typename DataT, El::Device D>
141void SelectOperator<DataT, D>::fp_compute_local(

Callers 2

fp_compute_localMethod · 0.85
bp_compute_localMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected