diff --git a/paddle/fluid/operators/reader/create_custom_reader_op.cc b/paddle/fluid/operators/reader/create_custom_reader_op.cc index 4ecbf8ed4f0473a552b778fd6c64c92b946cd458..331224a59899b4a7d517ca4f7141fb5b8f4f5168 100644 --- a/paddle/fluid/operators/reader/create_custom_reader_op.cc +++ b/paddle/fluid/operators/reader/create_custom_reader_op.cc @@ -23,13 +23,12 @@ namespace reader { class CustomReader : public framework::DecoratedReader { public: CustomReader(ReaderBase* reader, const framework::BlockDesc& sub_block, - const platform::Place& dev_place, const std::vector& source_var_names, const std::vector& sink_var_names) : DecoratedReader(reader), program_(*sub_block.Program()), sub_block_id_(sub_block.ID()), - exe_(framework::Executor(dev_place)), + exe_(framework::Executor(platform::CPUPlace())), source_var_names_(source_var_names), sink_var_names_(sink_var_names) {} @@ -60,7 +59,7 @@ class CreateCustomReaderOp : public framework::OperatorBase { const auto& underlying_reader = scope.FindVar(Input("UnderlyingReader")) ->Get(); out->Reset( - new CustomReader(underlying_reader.Get(), *sub_block, dev_place, + new CustomReader(underlying_reader.Get(), *sub_block, Attr>("source_var_names"), Attr>("sink_var_names"))); } @@ -85,9 +84,10 @@ class CreateCustomReaderOpMaker : public DecoratedReaderMakerBase { CreateCustomReader Operator A custom reader can be used for input data preprocessing. - A custom reader holds its own sub-block, which will be executed in its - 'ReadNext()' function. Users can configurate their own preprocessing - pipelines by inserting operators into custom reader's sub-block. + A custom reader holds its own sub-block, which will be executed in CPU + in its 'ReadNext()' function. Users can configurate their own + preprocessing pipelines by inserting operators into custom reader's + sub-block. )DOC"); } }; diff --git a/python/paddle/fluid/layers/nn.py b/python/paddle/fluid/layers/nn.py index f049dd6fd9ec7485bba17feb09e8b68550353bc3..3bb9fd04038b2a0ee98cbfb17b5c0ea0b8b06789 100644 --- a/python/paddle/fluid/layers/nn.py +++ b/python/paddle/fluid/layers/nn.py @@ -4009,7 +4009,8 @@ def random_crop(input, shape, seed=1): attrs={ "dtype": seed.dtype, "shape": [1], - "value": float(seed_value) + "value": float(seed_value), + "force_cpu": True }) elif not isinstance(seed, Variable): raise ValueError("'seed' must be a Variable or an int.")