未验证 提交 4113d440 编写于 作者: Y Yanzhan Yang 提交者: GitHub

fix dim equality test && fix fetch var sync bug (#1805)

上级 e092c619
......@@ -133,6 +133,10 @@ bool DDim::operator==(DDim d) const {
std::vector<int64_t> v1 = vectorize(*this);
std::vector<int64_t> v2 = vectorize(d);
if (v1.size() != v2.size()) {
return false;
}
for (unsigned int i = 0; i < v1.size(); i++) {
if (v1[i] != v2[i]) {
return false;
......
......@@ -89,7 +89,7 @@ class Tensor : public TensorBase {
/*! The internal of two tensors share the same memory block. */
inline Tensor &ShareDataWith(const Tensor &src) {
src.check_memory_size();
if (holder_.get() != src.holder_.get()) {
if (holder_.get() != src.holder_.get() || dims_ != src.dims()) {
*this = src;
}
return *this;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册