7 #ifndef MSHADOW_EXTENSION_FILL_H_ 8 #define MSHADOW_EXTENSION_FILL_H_ 10 #include "../extension.h" 22 template<
typename SrcExp,
typename ValExp,
typename IndexExp,
typename DType>
24 public Exp<MatFillRowElementExp<SrcExp, ValExp, IndexExp, DType>,
25 DType, type::kChainer> {
33 : src_(src), val_(val), index_(index) {}
36 template<
typename SrcExp,
typename ValExp,
typename IndexExp,
37 typename SDType,
typename VDType,
typename IDType,
int e1,
int e2,
int e3>
51 template<
typename SrcExp,
typename ValExp,
typename IndexExp,
typename DType>
62 return static_cast<DType
>(
val_.Eval(0, y));
64 return static_cast<DType
>(
src_.Eval(y, x));
74 template<
typename SrcExp,
typename ValExp,
typename IndexExp,
typename DType>
80 template<
int dim,
typename SrcExp,
typename ValExp,
typename IndexExp,
typename DType>
85 <<
"MatFillRowElementExp only support 2 dimension output";
89 CHECK((shape_src[0] == shape_index[0]) && (shape_index[0] == shape_val[0]))
90 <<
"mat_fill_row_element index length, val length and number of rows in matrix";
95 template<
typename SrcExp,
typename ValExp,
typename IndexExp,
typename DType>
97 static const int kDim = 2;
98 static const int kDevMask =
103 #endif // MSHADOW_EXTENSION_FILL_H_ MatFillRowElementExp(const SrcExp &src, const ValExp &val, const IndexExp &index)
constructor
Definition: fill.h:32
Definition: expr_engine-inl.h:40
used to help static type check
Definition: expr_engine-inl.h:312
const IndexExp & index_
index operand
Definition: fill.h:30
MSHADOW_XINLINE DType Eval(index_t y, index_t x) const
Definition: fill.h:59
static Shape< dim > Check(const E &t)
#define MSHADOW_XINLINE
Definition: base.h:204
static type inference template, used to get the dimension of each expression, if ExpInfo<E>::kDim == ...
Definition: expr_engine-inl.h:244
int32_t index_t
type that will be used for index
Definition: base.h:291
const ValExp & val_
Definition: fill.h:28
Plan(const MatFillRowElementExp< SrcExp, ValExp, IndexExp, DType > &e)
Definition: fill.h:54
runtime shape checking template get the shape of an expression, report error if shape mismatch ...
Definition: expr_engine-inl.h:346
const SrcExp & src_
src operand
Definition: fill.h:27
Set value of a specific element in each line of the data matrix.
Definition: fill.h:23
defines how expression exp can be evaluated and stored into dst
Definition: expression.h:61
const SubType & self(void) const
Definition: expression.h:64
Plan< BinaryMapExp< OP, TA, TB, DType, etype >, DType > MakePlan(const BinaryMapExp< OP, TA, TB, DType, etype > &e)
Definition: expr_engine-inl.h:221
namespace for mshadow
Definition: base.h:282
MatFillRowElementExp< SrcExp, ValExp, IndexExp, SDType > mat_fill_row_element(const Exp< SrcExp, SDType, e1 > &src, const Exp< ValExp, VDType, e2 > &val, const Exp< IndexExp, IDType, e3 > &index)
Definition: fill.h:39
static Shape< dim > Check(const MatFillRowElementExp< SrcExp, ValExp, IndexExp, DType > &t)
Definition: fill.h:83