Go to the documentation of this file.
25 #ifndef MSHADOW_EXTENSION_REDUCETO1D_H_
26 #define MSHADOW_EXTENSION_REDUCETO1D_H_
27 #include "../extension.h"
40 template<
typename SrcExp,
typename DType,
typename Reducer,
int m_dimkeep>
42 public Exp<ReduceTo1DExp<SrcExp, DType, Reducer, m_dimkeep>,
43 DType, type::kComplex> {
59 template<
int dimkeep,
typename SrcExp,
typename DType,
int etype>
60 inline ReduceTo1DExp<SrcExp, DType,
red::sum,
74 template<
int dimkeep,
typename Reducer,
typename SrcExp,
typename DType,
int etype>
75 inline ReduceTo1DExp<SrcExp, DType, Reducer,
88 template<
typename SrcExp,
typename DType,
int etype>
89 inline ReduceTo1DExp<SrcExp, DType, red::sum, 1>
92 ::Error_Expression_Does_Not_Meet_Dimension_Req();
93 return sumall_except_dim<1>(exp);
95 template<
typename SV,
typename Device,
typename DType,
96 typename SrcExp,
typename Reducer,
int m_dimkeep>
104 Reducer, m_dimkeep> &exp) {
107 MapReduceKeepHighDim<SV, Reducer, dimkeep>(dst, exp.src_, exp.scale_);
110 template<
typename SV,
typename Device,
typename DType,
111 typename SrcExp,
typename Reducer>
117 MapReduceKeepLowest<SV, Reducer>(dst, exp.
src_, exp.
scale_);
122 #endif // MSHADOW_EXTENSION_REDUCETO1D_H_
ReduceTo1DExp(const SrcExp &src, DType scale)
construct a repmat expression from src and nrow
Definition: reduceto1d.h:49
const SubType & self(void) const
Definition: expression.h:82
used to help static type check
Definition: expr_engine-inl.h:330
const SrcExp & src_
source operand
Definition: reduceto1d.h:45
DType scale_
source operand, scale of the
Definition: reduceto1d.h:47
general tensor
Definition: tensor.h:525
sum reducer
Definition: base.h:987
ReduceTo1DExp< SrcExp, DType, Reducer, ExpInfo< SrcExp >::kDim - dimkeep > reduce_except_dim(const Exp< SrcExp, DType, etype > &exp)
reduce over all dimensions, except dimkeep
Definition: reduceto1d.h:77
static type inference template, used to get the dimension of each expression, if ExpInfo<E>::kDim == ...
Definition: expr_engine-inl.h:262
static const int kDim
Definition: expr_engine-inl.h:263
some engine that evaluate complex expression
Definition: expr_engine-inl.h:455
reduction to 1 dimension tensor input: Tensor<Device,k>: ishape output: Tensor<Device,...
Definition: reduceto1d.h:41
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
static void Eval(Tensor< Device, 1, DType > *dst, const ReduceTo1DExp< SrcExp, DType, Reducer, 1 > &exp)
Definition: reduceto1d.h:115
ReduceTo1DExp< SrcExp, DType, red::sum, ExpInfo< SrcExp >::kDim - dimkeep > sumall_except_dim(const Exp< SrcExp, DType, etype > &exp)
a sum over all dimensions, except dimkeep
Definition: reduceto1d.h:62
static void Eval(Tensor< Device, 1, DType > *dst, const ReduceTo1DExp< SrcExp, DType, Reducer, m_dimkeep > &exp)
Definition: reduceto1d.h:102
ReduceTo1DExp< SrcExp, DType, red::sum, 1 > sum_rows(const Exp< SrcExp, DType, etype > &exp)
a expression that sum over rows of a matrix
Definition: reduceto1d.h:90