Go to the documentation of this file.
25 #ifndef MSHADOW_EXTENSION_TAKE_H_
26 #define MSHADOW_EXTENSION_TAKE_H_
28 #include "../extension.h"
38 template<
typename IndexExp,
typename SrcExp,
typename DType>
39 struct TakeExp:
public Exp<TakeExp<IndexExp, SrcExp, DType>,
40 DType, type::kChainer> {
46 TakeExp(
const IndexExp &index,
const SrcExp &src)
52 template<
typename IndexExp,
56 inline TakeExp<IndexExp, SrcExp, DType>
67 template<
typename IndexExp,
typename SrcExp,
typename DType>
78 return static_cast<DType
>(src_.Eval(idx, x));
86 template<
typename IndexExp,
typename SrcExp,
typename DType>
87 inline Plan<TakeExp<IndexExp, SrcExp, DType>, DType>
92 template<
int dim,
typename IndexExp,
typename SrcExp,
typename DType>
97 <<
"TakeExp only support 2D output";
108 template<
typename IndexExp,
typename SrcExp,
typename DType>
117 #endif // MSHADOW_EXTENSION_TAKE_H_
MSHADOW_XINLINE DType Eval(index_t y, index_t x) const
Definition: take.h:76
static const int kDevMask
Definition: expr_engine-inl.h:264
const SubType & self(void) const
Definition: expression.h:82
TakeExp< IndexExp, SrcExp, DType > take(const Exp< IndexExp, DType, e1 > &index, const Exp< SrcExp, DType, e2 > &src)
Definition: take.h:57
static Shape< dim > Check(const TakeExp< IndexExp, SrcExp, DType > &t)
Definition: take.h:95
#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
static Shape< dim > Check(const E &t)
TakeExp(const IndexExp &index, const SrcExp &src)
Definition: take.h:46
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
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
Take a column from a matrix.
Definition: take.h:39
defines how expression exp can be evaluated and stored into dst
Definition: expression.h:79
const IndexExp & index_
index oprand
Definition: take.h:42
overloaded + operator between half_t and bf16_t
Definition: base.h:319
const SrcExp & src_
embediing oprand
Definition: take.h:44
Plan(const TakeExp< IndexExp, SrcExp, DType > &e)
Definition: take.h:70