MCPcopy Create free account
hub / github.com/apache/singa / GpuPoolingForward

Function GpuPoolingForward

src/model/operation/pooling.cc:187–205  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

185}
186
187Tensor GpuPoolingForward(const CudnnPoolingHandle &cph, const Tensor &x) {
188 CHECK_EQ(x.device()->lang(), kCuda);
189 CHECK_EQ(x.nDim(), 4u);
190
191 Tensor output = Tensor(
192 Shape({cph.batchsize, cph.channels, cph.pooled_height, cph.pooled_width}),
193 x.device(), x.data_type());
194
195 output.device()->Exec(
196 [output, x, &cph](Context *ctx) mutable {
197 float alpha = 1.0f, beta = 0.0f;
198 cudnnPoolingForward(ctx->cudnn_handle, cph.pool_desc, &alpha,
199 cph.x_desc, x.block()->data(), &beta, cph.y_desc,
200 output.block()->mutable_data());
201 },
202 {x.block()}, {output.block()}, "GpuPoolingForward");
203
204 return output;
205}
206
207Tensor GpuPoolingBackward(const CudnnPoolingHandle &cph, const Tensor &dy,
208 const Tensor &x, const Tensor &y) {

Callers

nothing calls this directly

Calls 10

ShapeClass · 0.85
langMethod · 0.80
deviceMethod · 0.80
nDimMethod · 0.80
data_typeMethod · 0.80
ExecMethod · 0.80
mutable_dataMethod · 0.80
TensorClass · 0.50
dataMethod · 0.45
blockMethod · 0.45

Tested by

no test coverage detected