"fix mixed_vector bug" (#9319)

helinwang-patch-1
dzhwinter 7 years ago committed by GitHub
parent 3c8bbd306f
commit 13f1050ab0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -176,7 +176,7 @@ class Vector {
// resize the vector
void resize(size_t size) {
if (size + 1 < capacity()) {
if (size + 1 <= capacity()) {
size_ = size;
} else {
MutableCPU();

@ -104,3 +104,11 @@ TEST(mixed_vector, ForEach) {
for (auto& v : tmp) {
}
}
TEST(mixed_vector, Reserve) {
paddle::framework::Vector<int> vec;
vec.reserve(1);
vec.push_back(0);
vec.push_back(0);
vec.push_back(0);
}

Loading…
Cancel
Save