Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
Fix warning / static function in header. (#14900)
Browse files Browse the repository at this point in the history
* Fix warning

* CR comments

* Fix windows CI

* as per Haojin2 request, moving to op namespace
  • Loading branch information
larroy authored and szha committed May 23, 2019
1 parent d2e397a commit 503c750
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 18 deletions.
18 changes: 0 additions & 18 deletions src/operator/nn/dropout-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -492,24 +492,6 @@ class DropoutOp {
#endif // MXNET_USE_CUDNN_DROPOUT
}; // class DropoutOp

static OpStatePtr CreateDropoutState(const nnvm::NodeAttrs &attrs,
const Context ctx,
const mxnet::ShapeVector &in_shapes,
const std::vector<int> &in_types) {
const DropoutParam& param = nnvm::get<DropoutParam>(attrs.parsed);
OpStatePtr state;
MSHADOW_REAL_TYPE_SWITCH(in_types[dropout::kData], DType, {
if (ctx.dev_type == kGPU) {
state = OpStatePtr::Create<DropoutOp<gpu, DType>>(param, ctx);
} else {
state = OpStatePtr::Create<DropoutOp<cpu, DType>>(param, ctx);
}
return state;
});
LOG(FATAL) << "should never reach here";
return OpStatePtr(); // should never reach here
}

template<typename xpu>
void DropoutCompute(const OpStatePtr& state,
const OpContext& ctx,
Expand Down
21 changes: 21 additions & 0 deletions src/operator/nn/dropout.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,31 @@

#include "./dropout-inl.h"
#include "../operator_common.h"
#include "mxnet/op_attr_types.h"



namespace mxnet {
namespace op {

OpStatePtr CreateDropoutState(const nnvm::NodeAttrs &attrs,
const Context ctx,
const mxnet::ShapeVector &in_shapes,
const std::vector<int> &in_types) {
const auto& param = nnvm::get<DropoutParam>(attrs.parsed);
OpStatePtr state;
MSHADOW_REAL_TYPE_SWITCH(in_types[dropout::kData], DType, {
if (ctx.dev_type == kGPU) {
state = OpStatePtr::Create<DropoutOp<mxnet::gpu, DType>>(param, ctx);
} else {
state = OpStatePtr::Create<DropoutOp<mxnet::cpu, DType>>(param, ctx);
}
return state;
});
LOG(FATAL) << "should never reach here";
return OpStatePtr(); // should never reach here
}

struct DropoutGrad {
const char *op_name;
std::vector<nnvm::NodeEntry> operator()(const nnvm::NodePtr& n,
Expand Down

0 comments on commit 503c750

Please sign in to comment.