24 #ifndef MSHADOW_EXTENSION_SLICE_EX_H_ 25 #define MSHADOW_EXTENSION_SLICE_EX_H_ 27 #include "../extension.h" 38 template<
typename SrcExp,
typename Device,
39 typename DType,
int srcdim>
43 Device, srcdim, DType> {
50 : src_(src), begin_(begin), end_(end) {
52 for (
int i = 0; i < srcdim; ++i) {
53 shape_[i] = end_[i] - begin_[i];
56 template<
typename E,
int etype>
78 template<
typename SrcExp,
typename Device,
79 typename DType,
int srcdim>
83 ::Error_Expression_Does_Not_Meet_Dimension_Req();
90 template<
typename SrcExp,
typename Device,
91 typename DType,
int srcdim>
94 Device, DType, srcdim> &t) {
99 template<
typename SrcExp,
typename Device,
100 typename DType,
int srcdim>
108 template<
typename SrcExp,
typename Device,
109 typename DType,
int srcdim>
117 template<
typename SrcExp,
typename Device,
118 typename DType,
int srcdim>
128 for (
int k = srcdim-2; k >= 0; --k) {
139 for (
int k = srcdim-2; k >= 0; --k) {
153 #endif // MSHADOW_EXTENSION_SLICE_EX_H_ slice expression, slice a tensor's channel
Definition: slice_ex.h:40
Tensor RValue, this is the super type of all kinds of possible tensors.
Definition: tensor.h:409
const Container & self(void) const
Definition: expression.h:82
const SrcExp & src_
Definition: slice_ex.h:44
Definition: expr_engine-inl.h:58
used to help static type check
Definition: expr_engine-inl.h:330
const Shape< srcdim > end_
Definition: slice_ex.h:48
const Shape< srcdim > begin_
Definition: slice_ex.h:47
Plan(const SliceExExp< SrcExp, Device, DType, srcdim > &e)
Definition: slice_ex.h:121
void operator=(const DType &exp)
Definition: slice_ex.h:62
static Shape< dim > Check(const E &t)
#define MSHADOW_XINLINE
Definition: base.h:230
SliceExp< SrcExp, Device, DType, srcdim, srcdim - sdim > slice(const TRValue< SrcExp, Device, srcdim, DType > &src, index_t begin, index_t end)
Slice a Tensor.
Definition: slice.h:83
static type inference template, used to get the dimension of each expression, if ExpInfo<E>::kDim == ...
Definition: expr_engine-inl.h:262
Definition: expr_engine-inl.h:345
int32_t index_t
type that will be used for index
Definition: base.h:343
static Stream< Device > * Get(const SliceExExp< SrcExp, Device, DType, srcdim > &t)
Definition: slice_ex.h:103
MSHADOW_XINLINE DType & REval(index_t i, index_t j)
Definition: slice_ex.h:135
Shape< srcdim > src_shape_
Definition: slice_ex.h:45
index_t shape_[kDimension]
storing the dimension information
Definition: tensor.h:75
runtime shape checking template get the shape of an expression, report error if shape mismatch ...
Definition: expr_engine-inl.h:364
static Stream< Device > * Get(const E &t)
MSHADOW_XINLINE DType Eval(index_t i, index_t j) const
Definition: slice_ex.h:124
static Shape< srcdim > Check(const SliceExExp< SrcExp, Device, DType, srcdim > &t)
Definition: slice_ex.h:93
defines how expression exp can be evaluated and stored into dst
Definition: expression.h:79
Plan< BinaryMapExp< OP, TA, TB, DType, etype >, DType > MakePlan(const BinaryMapExp< OP, TA, TB, DType, etype > &e)
Definition: expr_engine-inl.h:239
SliceExExp(const SrcExp &src, Shape< srcdim > begin, Shape< srcdim > end)
Definition: slice_ex.h:49
overloaded + operator between half_t and bf16_t
Definition: base.h:334
SliceExExp< SrcExp, Device, DType, srcdim > & __assign(DType s)
operator overload
Definition: expression.h:178
void operator=(const expr::Exp< E, DType, etype > &exp)
Definition: slice_ex.h:58
Shape< srcdim > shape_
Definition: slice_ex.h:46
computaion stream structure, used for asynchronous computations
Definition: tensor.h:383