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 8e13810 commit 6773b64
Show file tree
Hide file tree
Showing 2 changed files with 26 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
26 changes: 26 additions & 0 deletions src/operator/nn/dropout.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,32 @@

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

namespace {

using namespace mxnet;
using namespace mxnet::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<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 6773b64

Please sign in to comment.