提交 13d30b0d 编写于 作者: H HexToString

fix the owned

上级 c74f2fa5
......@@ -661,9 +661,8 @@ class FluidInferEngine : public CloneDBReloadableInferEngine<FluidFamilyCore> {
lod_element.assign(out_lod[li].begin(), out_lod[li].end());
tensor_out.lod.push_back(lod_element);
}
tensor_out.data = DataBuf(databuf_data,databuf_size,true);
batchTensor_pointer_out->push_back(tensor_out);
tensor_out.data = DataBuf(databuf_data,databuf_size);
batchTensor_pointer_out->push_back_owned(tensor_out);
}
return 0;
}
......
......@@ -39,6 +39,10 @@ class DataBuf {
size_t size() const { return _size; }
void set_owned(bool owned){
this._owned = owned;
}
void free() {
_size = 0;
if (_owned) {
......@@ -145,6 +149,12 @@ class BatchTensor {
void push_back(const Tensor& tensor) { _features.push_back(tensor); }
void push_back_owned(const Tensor& tensor){
_features.push_back(tensor);
//change the DataBuf parameter "owned"= true
_features[count()-1].data.set_owned(true);
}
size_t count() const { return _features.size(); }
size_t size() const {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册