提交 db5f1aa5 编写于 作者: J Jiaying Zhao 提交者: zp7

add implementation of virtual function for GPU and fpga (#1762)

上级 b22b8c47
...@@ -168,6 +168,13 @@ class CLTensor : public TensorBase { ...@@ -168,6 +168,13 @@ class CLTensor : public TensorBase {
size_ = size; size_ = size;
} }
virtual void realloc(size_t size) {
capatity_ = size;
ptr_.reset(
clCreateBuffer(context_, CL_MEM_READ_WRITE, capatity_, NULL, NULL));
size_ = size;
}
std::unique_ptr<_cl_mem, CLMemDeleter> ptr_; std::unique_ptr<_cl_mem, CLMemDeleter> ptr_;
size_t size_; size_t size_;
......
...@@ -247,6 +247,12 @@ class Tensor : public TensorBase { ...@@ -247,6 +247,12 @@ class Tensor : public TensorBase {
size_ = size; size_ = size;
} }
virtual void realloc(size_t size) {
capatity_ = size;
// TODO(chonwhite) implement;
size_ = size;
}
void resize(DDim ddim, const kTypeId_t type) { void resize(DDim ddim, const kTypeId_t type) {
std::vector<int> v = framework::vectorize2int(ddim); std::vector<int> v = framework::vectorize2int(ddim);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册