diff --git a/src/framework/cl/cl_tensor.h b/src/framework/cl/cl_tensor.h index 01fdc7970e772e945ae880cee5bdc2bec589ffab..5bb4055eff43005bb51082e7516b37c3c1ff669c 100644 --- a/src/framework/cl/cl_tensor.h +++ b/src/framework/cl/cl_tensor.h @@ -168,6 +168,13 @@ class CLTensor : public TensorBase { 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_; size_t size_; diff --git a/src/framework/zynqmp/ztensor.hpp b/src/framework/zynqmp/ztensor.hpp index cd49a0acb38d9b0af97ff6a6de63edfa280ab245..d68e43b6dc66738ef5bd2b99d9e08f3122f852b5 100644 --- a/src/framework/zynqmp/ztensor.hpp +++ b/src/framework/zynqmp/ztensor.hpp @@ -247,6 +247,12 @@ class Tensor : public TensorBase { size_ = size; } + virtual void realloc(size_t size) { + capatity_ = size; + // TODO(chonwhite) implement; + size_ = size; + } + void resize(DDim ddim, const kTypeId_t type) { std::vector v = framework::vectorize2int(ddim);