Skip to content

Commit

Permalink
style fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ktlichkid committed May 15, 2018
1 parent 2d498b1 commit 36e7845
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions paddle/fluid/operators/has_data_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,23 @@ class HasDataOp : public framework::OperatorWithKernel {
using framework::OperatorWithKernel::OperatorWithKernel;

protected:
void InferShape(framework::InferShapeContext *ctx) const override {
PADDLE_ENFORCE(ctx->HasInput("X"),
"Input(X) of HasDataOp should not be null.");
PADDLE_ENFORCE(ctx->HasOutput("Out"),
"Output(Out) of HasDataOp should not be null.");
ctx->SetOutputDim("Out", {1});
ctx->ShareLoD("X", "Out");
}
void InferShape(framework::InferShapeContext *ctx) const override {
PADDLE_ENFORCE(ctx->HasInput("X"),
"Input(X) of HasDataOp should not be null.");
PADDLE_ENFORCE(ctx->HasOutput("Out"),
"Output(Out) of HasDataOp should not be null.");
ctx->SetOutputDim("Out", {1});
ctx->ShareLoD("X", "Out");
}

framework::OpKernelType GetExpectedKernelType(
const framework::ExecutionContext &ctx) const override {
framework::OpKernelType kt = framework::OpKernelType(
framework::OpKernelType GetExpectedKernelType(
const framework::ExecutionContext &ctx) const override {
framework::OpKernelType kt = framework::OpKernelType(
framework::ToDataType(
ctx.Input<framework::LoDTensor>("X")->type()),
platform::CPUPlace());
return kt;
}
return kt;
}
};

} // namespace operators
Expand All @@ -66,8 +66,7 @@ namespace ops = paddle::operators;

REGISTER_OPERATOR(has_data, ops::HasDataOp, ops::HasDataOpMaker);
REGISTER_OP_CPU_KERNEL(
has_data,
ops::HasDataOpKernel<paddle::platform::CPUDeviceContext, float>,
has_data, ops::HasDataOpKernel<paddle::platform::CPUDeviceContext, float>,
ops::HasDataOpKernel<paddle::platform::CPUDeviceContext, double>,
ops::HasDataOpKernel<paddle::platform::CPUDeviceContext, int>,
ops::HasDataOpKernel<paddle::platform::CPUDeviceContext, int64_t>);

0 comments on commit 36e7845

Please sign in to comment.