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

Commit

Permalink
CR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
larroy committed May 21, 2019
1 parent 50f4176 commit 4e0a8fc
Show file tree
Hide file tree
Showing 2 changed files with 23 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

inline 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
23 changes: 23 additions & 0 deletions src/operator/nn/dropout.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,29 @@
#include "./dropout-inl.h"
#include "../operator_common.h"

namespace {

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
}

} // anonymous namespace


namespace mxnet {
namespace op {

Expand Down

0 comments on commit 4e0a8fc

Please sign in to comment.