Skip to content

Commit 32c0e82

Browse files
committed
fix two bugs
1 parent 1490551 commit 32c0e82

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

paddle/fluid/operators/reader/create_custom_reader_op.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,12 @@ namespace reader {
2323
class CustomReader : public framework::DecoratedReader {
2424
public:
2525
CustomReader(ReaderBase* reader, const framework::BlockDesc& sub_block,
26-
const platform::Place& dev_place,
2726
const std::vector<std::string>& source_var_names,
2827
const std::vector<std::string>& sink_var_names)
2928
: DecoratedReader(reader),
3029
program_(*sub_block.Program()),
3130
sub_block_id_(sub_block.ID()),
32-
exe_(framework::Executor(dev_place)),
31+
exe_(framework::Executor(platform::CPUPlace())),
3332
source_var_names_(source_var_names),
3433
sink_var_names_(sink_var_names) {}
3534

@@ -60,7 +59,7 @@ class CreateCustomReaderOp : public framework::OperatorBase {
6059
const auto& underlying_reader = scope.FindVar(Input("UnderlyingReader"))
6160
->Get<framework::ReaderHolder>();
6261
out->Reset(
63-
new CustomReader(underlying_reader.Get(), *sub_block, dev_place,
62+
new CustomReader(underlying_reader.Get(), *sub_block,
6463
Attr<std::vector<std::string>>("source_var_names"),
6564
Attr<std::vector<std::string>>("sink_var_names")));
6665
}
@@ -85,9 +84,10 @@ class CreateCustomReaderOpMaker : public DecoratedReaderMakerBase {
8584
CreateCustomReader Operator
8685
8786
A custom reader can be used for input data preprocessing.
88-
A custom reader holds its own sub-block, which will be executed in its
89-
'ReadNext()' function. Users can configurate their own preprocessing
90-
pipelines by inserting operators into custom reader's sub-block.
87+
A custom reader holds its own sub-block, which will be executed in CPU
88+
in its 'ReadNext()' function. Users can configurate their own
89+
preprocessing pipelines by inserting operators into custom reader's
90+
sub-block.
9191
)DOC");
9292
}
9393
};

python/paddle/fluid/layers/nn.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4009,7 +4009,8 @@ def random_crop(input, shape, seed=1):
40094009
attrs={
40104010
"dtype": seed.dtype,
40114011
"shape": [1],
4012-
"value": float(seed_value)
4012+
"value": float(seed_value),
4013+
"force_cpu": True
40134014
})
40144015
elif not isinstance(seed, Variable):
40154016
raise ValueError("'seed' must be a Variable or an int.")

0 commit comments

Comments
 (0)