提交 a402d2b3 编写于 作者: D dzhwinter

"fix condition"

上级 63320f72
...@@ -132,7 +132,7 @@ class LoDTensor : public Tensor { ...@@ -132,7 +132,7 @@ class LoDTensor : public Tensor {
void set_lod(const LoD& lod) { void set_lod(const LoD& lod) {
lod_ = lod; lod_ = lod;
if (holder_ != nullptr && if (holder_ != nullptr &&
platform::is_same_place(holder_->place(), lod.place())) { !platform::is_same_place(holder_->place(), lod.place())) {
lod_.CopyToPeer(holder_->place()); lod_.CopyToPeer(holder_->place());
} }
} }
......
...@@ -42,7 +42,13 @@ class SelectedRows { ...@@ -42,7 +42,13 @@ class SelectedRows {
Vector<int64_t>* mutable_rows() { return &rows_; } Vector<int64_t>* mutable_rows() { return &rows_; }
void set_rows(const Vector<int64_t>& rows) { rows_ = rows; } void set_rows(const Vector<int64_t>& rows) {
rows_ = rows;
if (value_ != nullptr &&
!platform::is_same_place(value_->place(), rows.place())) {
rows_.mutable_data(value_->place());
}
}
DDim GetCompleteDims() const { DDim GetCompleteDims() const {
std::vector<int64_t> dims = vectorize(value_->dims()); std::vector<int64_t> dims = vectorize(value_->dims());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册