Go to the documentation of this file.
25 #ifndef MSHADOW_EXTENSION_CHOOSE_H_
26 #define MSHADOW_EXTENSION_CHOOSE_H_
28 #include "../extension.h"
38 template<
typename SrcExp,
typename IndexExp,
typename DType>
40 public Exp<MatChooseRowElementExp<SrcExp, IndexExp, DType>,
41 DType, type::kChainer> {
51 template<
typename SrcExp,
typename IndexExp,
52 typename DType,
typename IDType,
int e1,
int e2>
53 inline MatChooseRowElementExp<SrcExp, IndexExp, DType>
57 ::Error_Expression_Does_Not_Meet_Dimension_Req();
64 template<
typename SrcExp,
typename IndexExp,
typename DType>
73 return src_.Eval(x, idx);
81 template<
typename SrcExp,
typename IndexExp,
typename DType>
82 inline Plan<MatChooseRowElementExp<SrcExp, IndexExp, DType>, DType>
87 template<
int dim,
typename SrcExp,
typename IndexExp,
typename DType>
92 <<
"MatChooseRowElementExp only support 1 dimension output";
95 CHECK_EQ(shape1[0], shape2[0])
96 <<
"mat_choose_row_element index length and number of rows in matrix";
101 template<
typename SrcExp,
typename IndexExp,
typename DType>
108 #endif // MSHADOW_EXTENSION_CHOOSE_H_
static const int kDevMask
Definition: expr_engine-inl.h:264
const SubType & self(void) const
Definition: expression.h:82
used to help static type check
Definition: expr_engine-inl.h:330
static Shape< dim > Check(const MatChooseRowElementExp< SrcExp, IndexExp, DType > &t)
Definition: choose.h:90
#define MSHADOW_XINLINE
Definition: base.h:228
runtime shape checking template get the shape of an expression, report error if shape mismatch
Definition: expr_engine-inl.h:364
MSHADOW_XINLINE DType Eval(index_t y, index_t x) const
Definition: choose.h:71
static Shape< dim > Check(const E &t)
static type inference template, used to get the dimension of each expression, if ExpInfo<E>::kDim == ...
Definition: expr_engine-inl.h:262
Plan< BinaryMapExp< OP, TA, TB, DType, etype >, DType > MakePlan(const BinaryMapExp< OP, TA, TB, DType, etype > &e)
Definition: expr_engine-inl.h:239
MatChooseRowElementExp< SrcExp, IndexExp, DType > mat_choose_row_element(const Exp< SrcExp, DType, e1 > &src, const Exp< IndexExp, IDType, e2 > &index)
Definition: choose.h:54
Plan(const MatChooseRowElementExp< SrcExp, IndexExp, DType > &e)
Definition: choose.h:67
static const int kDim
Definition: expr_engine-inl.h:263
int32_t index_t
type that will be used for index
Definition: base.h:328
Definition: expr_engine-inl.h:58
defines how expression exp can be evaluated and stored into dst
Definition: expression.h:79
overloaded + operator between half_t and bf16_t
Definition: base.h:319
const IndexExp & index_
index operand
Definition: choose.h:45
Make a choice of index in the lowest changing dimension.
Definition: choose.h:39
const SrcExp & src_
source operand
Definition: choose.h:43
MatChooseRowElementExp(const SrcExp &src, const IndexExp &index)
constructor
Definition: choose.h:47