@@ -40,23 +40,23 @@ class HasDataOp : public framework::OperatorWithKernel {
4040 using framework::OperatorWithKernel::OperatorWithKernel;
4141
4242 protected:
43- void InferShape (framework::InferShapeContext *ctx) const override {
44- PADDLE_ENFORCE (ctx->HasInput (" X" ),
45- " Input(X) of HasDataOp should not be null." );
46- PADDLE_ENFORCE (ctx->HasOutput (" Out" ),
47- " Output(Out) of HasDataOp should not be null." );
48- ctx->SetOutputDim (" Out" , {1 });
49- ctx->ShareLoD (" X" , " Out" );
50- }
43+ void InferShape (framework::InferShapeContext *ctx) const override {
44+ PADDLE_ENFORCE (ctx->HasInput (" X" ),
45+ " Input(X) of HasDataOp should not be null." );
46+ PADDLE_ENFORCE (ctx->HasOutput (" Out" ),
47+ " Output(Out) of HasDataOp should not be null." );
48+ ctx->SetOutputDim (" Out" , {1 });
49+ ctx->ShareLoD (" X" , " Out" );
50+ }
5151
52- framework::OpKernelType GetExpectedKernelType (
53- const framework::ExecutionContext &ctx) const override {
54- framework::OpKernelType kt = framework::OpKernelType (
52+ framework::OpKernelType GetExpectedKernelType (
53+ const framework::ExecutionContext &ctx) const override {
54+ framework::OpKernelType kt = framework::OpKernelType (
5555 framework::ToDataType (
5656 ctx.Input <framework::LoDTensor>(" X" )->type ()),
5757 platform::CPUPlace ());
58- return kt;
59- }
58+ return kt;
59+ }
6060};
6161
6262} // namespace operators
@@ -66,8 +66,7 @@ namespace ops = paddle::operators;
6666
6767REGISTER_OPERATOR (has_data, ops::HasDataOp, ops::HasDataOpMaker);
6868REGISTER_OP_CPU_KERNEL (
69- has_data,
70- ops::HasDataOpKernel<paddle::platform::CPUDeviceContext, float >,
69+ has_data, ops::HasDataOpKernel<paddle::platform::CPUDeviceContext, float >,
7170 ops::HasDataOpKernel<paddle::platform::CPUDeviceContext, double >,
7271 ops::HasDataOpKernel<paddle::platform::CPUDeviceContext, int >,
7372 ops::HasDataOpKernel<paddle::platform::CPUDeviceContext, int64_t >);
0 commit comments