25 #ifndef MSHADOW_EXTENSION_SLICE_EX_H_ 26 #define MSHADOW_EXTENSION_SLICE_EX_H_ 28 #include "../extension.h" 39 template<
typename SrcExp,
typename Device,
40 typename DType,
int srcdim>
44 Device, srcdim, DType> {
51 : src_(src), begin_(begin), end_(end) {
53 for (
int i = 0; i < srcdim; ++i) {
54 shape_[i] = end_[i] - begin_[i];
57 template<
typename E,
int etype>
79 template<
typename SrcExp,
typename Device,
80 typename DType,
int srcdim>
84 ::Error_Expression_Does_Not_Meet_Dimension_Req();
91 template<
typename SrcExp,
typename Device,
92 typename DType,
int srcdim>
95 Device, DType, srcdim> &t) {
100 template<
typename SrcExp,
typename Device,
101 typename DType,
int srcdim>
109 template<
typename SrcExp,
typename Device,
110 typename DType,
int srcdim>
118 template<
typename SrcExp,
typename Device,
119 typename DType,
int srcdim>
129 for (
int k = srcdim-2; k >= 0; --k) {
140 for (
int k = srcdim-2; k >= 0; --k) {
154 #endif // MSHADOW_EXTENSION_SLICE_EX_H_ slice expression, slice a tensor's channel
Definition: slice_ex.h:41
Tensor RValue, this is the super type of all kinds of possible tensors.
Definition: tensor.h:410
const SrcExp & src_
Definition: slice_ex.h:45
Definition: expr_engine-inl.h:59
used to help static type check
Definition: expr_engine-inl.h:331
const Shape< srcdim > end_
Definition: slice_ex.h:49
const Shape< srcdim > begin_
Definition: slice_ex.h:48
Plan(const SliceExExp< SrcExp, Device, DType, srcdim > &e)
Definition: slice_ex.h:122
MSHADOW_XINLINE DType Eval(index_t i, index_t j) const
Definition: slice_ex.h:125
void operator=(const DType &exp)
Definition: slice_ex.h:63
static Shape< dim > Check(const E &t)
#define MSHADOW_XINLINE
Definition: base.h:223
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:84
static type inference template, used to get the dimension of each expression, if ExpInfo<E>::kDim == ...
Definition: expr_engine-inl.h:263
Definition: expr_engine-inl.h:346
int32_t index_t
type that will be used for index
Definition: base.h:336
static Stream< Device > * Get(const SliceExExp< SrcExp, Device, DType, srcdim > &t)
Definition: slice_ex.h:104
MSHADOW_XINLINE DType & REval(index_t i, index_t j)
Definition: slice_ex.h:136
Shape< srcdim > src_shape_
Definition: slice_ex.h:46
index_t shape_[kDimension]
storing the dimension information
Definition: tensor.h:76
runtime shape checking template get the shape of an expression, report error if shape mismatch ...
Definition: expr_engine-inl.h:365
static Stream< Device > * Get(const E &t)
static Shape< srcdim > Check(const SliceExExp< SrcExp, Device, DType, srcdim > &t)
Definition: slice_ex.h:94
defines how expression exp can be evaluated and stored into dst
Definition: expression.h:80
const Container & self(void) const
Definition: expression.h:83
Plan< BinaryMapExp< OP, TA, TB, DType, etype >, DType > MakePlan(const BinaryMapExp< OP, TA, TB, DType, etype > &e)
Definition: expr_engine-inl.h:240
SliceExExp(const SrcExp &src, Shape< srcdim > begin, Shape< srcdim > end)
Definition: slice_ex.h:50
overloaded + operator between half_t and bf16_t
Definition: base.h:327
SliceExExp< SrcExp, Device, DType, srcdim > & __assign(DType s)
operator overload
Definition: expression.h:179
void operator=(const expr::Exp< E, DType, etype > &exp)
Definition: slice_ex.h:59
Shape< srcdim > shape_
Definition: slice_ex.h:47
computaion stream structure, used for asynchronous computations
Definition: tensor.h:384