|
|
@ -16,6 +16,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
#include <algorithm>
|
|
|
|
#include <algorithm>
|
|
|
|
#include <initializer_list>
|
|
|
|
#include <initializer_list>
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
#include <vector>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
|
|
|
|
#include "paddle/fluid/framework/tensor.h"
|
|
|
|
#include "paddle/fluid/framework/tensor.h"
|
|
|
@ -386,13 +387,14 @@ template <typename T>
|
|
|
|
class CPUVector : public std::vector<T, std::allocator<T>> {
|
|
|
|
class CPUVector : public std::vector<T, std::allocator<T>> {
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
CPUVector() : std::vector<T>() {}
|
|
|
|
CPUVector() : std::vector<T>() {}
|
|
|
|
CPUVector(size_t count, const T &value = T())
|
|
|
|
explicit CPUVector(size_t count, const T &value = T())
|
|
|
|
: std::vector<T>(count, value) {}
|
|
|
|
: std::vector<T>(count, value) {}
|
|
|
|
CPUVector(std::initializer_list<T> init) : std::vector<T>(init) {}
|
|
|
|
CPUVector(std::initializer_list<T> init) : std::vector<T>(init) {}
|
|
|
|
CPUVector(const std::vector<T> &other) : std::vector<T>(other) {}
|
|
|
|
explicit CPUVector(const std::vector<T> &other) : std::vector<T>(other) {}
|
|
|
|
explicit CPUVector(const CPUVector<T> &other) : std::vector<T>(other) {}
|
|
|
|
explicit CPUVector(const CPUVector<T> &other) : std::vector<T>(other) {}
|
|
|
|
CPUVector(CPUVector<T> &&other) : std::vector<T>(std::move(other)) {}
|
|
|
|
CPUVector(CPUVector<T> &&other) : std::vector<T>(std::move(other)) {}
|
|
|
|
CPUVector(std::vector<T> &&other) : std::vector<T>(std::move(other)) {}
|
|
|
|
explicit CPUVector(std::vector<T> &&other)
|
|
|
|
|
|
|
|
: std::vector<T>(std::move(other)) {}
|
|
|
|
CPUVector &operator=(const CPUVector &other) {
|
|
|
|
CPUVector &operator=(const CPUVector &other) {
|
|
|
|
this->assign(other.begin(), other.end());
|
|
|
|
this->assign(other.begin(), other.end());
|
|
|
|
return *this;
|
|
|
|
return *this;
|
|
|
@ -410,8 +412,6 @@ class CPUVector : public std::vector<T, std::allocator<T>> {
|
|
|
|
return os;
|
|
|
|
return os;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void resize(size_t size) { this->resize(size); }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
T &operator[](size_t id) { return this->at(id); }
|
|
|
|
T &operator[](size_t id) { return this->at(id); }
|
|
|
|
|
|
|
|
|
|
|
|
const T &operator[](size_t id) const { return this->at(id); }
|
|
|
|
const T &operator[](size_t id) const { return this->at(id); }
|
|
|
|