Go to the documentation of this file.
25 #ifndef MSHADOW_EXTENSION_SPATIAL_UPSAMPLING_NEAREST_H_
26 #define MSHADOW_EXTENSION_SPATIAL_UPSAMPLING_NEAREST_H_
27 #include "../extension.h"
38 template<
typename SrcExp,
typename DType,
int srcdim>
40 public MakeTensorExp<UpSamplingNearestExp<SrcExp, DType, srcdim>,
41 SrcExp, srcdim, DType> {
56 template<
typename SrcExp,
typename DType,
int etype>
57 inline UpSamplingNearestExp<SrcExp, DType, ExpInfo<SrcExp>::kDim>
60 ::Error_Expression_Does_Not_Meet_Dimension_Req();
64 template<
typename SrcExp,
typename DType,
int srcdim>
70 new_height_(e.shape_[srcdim - 2]),
71 src_height_(static_cast<
index_t>(e.shape_[srcdim - 2] / e.scale_)) {}
74 const index_t y = i % new_height_;
75 const index_t c = i / new_height_;
78 return src_.Eval(c * src_height_ + h, w);
89 #endif // MSHADOW_EXTENSION_SPATIAL_UPSAMPLING_NEAREST_H_
MSHADOW_XINLINE DType Eval(index_t i, index_t j) const
Definition: spatial_upsampling_nearest.h:72
UpSamplingNearestExp< SrcExp, DType, ExpInfo< SrcExp >::kDim > upsampling_nearest(const Exp< SrcExp, DType, etype > &src, index_t scale)
Definition: spatial_upsampling_nearest.h:58
const SubType & self(void) const
Definition: expression.h:82
UpSamplingNearestExp(const SrcExp &src, index_t scale)
constructor
Definition: spatial_upsampling_nearest.h:47
used to help static type check
Definition: expr_engine-inl.h:330
#define MSHADOW_XINLINE
Definition: base.h:228
index_t scale_
up sampling scale
Definition: spatial_upsampling_nearest.h:45
static Shape< dim > Check(const E &t)
Plan(const UpSamplingNearestExp< SrcExp, DType, srcdim > &e)
Definition: spatial_upsampling_nearest.h:67
Plan< BinaryMapExp< OP, TA, TB, DType, etype >, DType > MakePlan(const BinaryMapExp< OP, TA, TB, DType, etype > &e)
Definition: expr_engine-inl.h:239
Shape< dim > shape_
the shape of this expression
Definition: expr_engine-inl.h:47
const SrcExp & src_
source oprand
Definition: spatial_upsampling_nearest.h:43
int32_t index_t
type that will be used for index
Definition: base.h:328
Definition: expr_engine-inl.h:58
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
a general class that allows extension that makes tensors of some shape
Definition: expr_engine-inl.h:43
nearest neighboor upsampling out(x, y) = in(int(x / scale_x), int(y / scale_y))
Definition: spatial_upsampling_nearest.h:39