已关闭
[Doc]: DestroyTensorPtr函数使用问题 #202
chenm_123创建于 1月29日关闭于 3月11日
2月2日 将 YeFeng_24 设为负责人
YeFeng_24
2月2日 评论:
2月2日 评论:
当前该接口的实现为:
void MSTensor::DestroyTensorPtr(MSTensor *tensor) noexcept {
if (tensor != nullptr) {
delete tensor;
}
}
你意思是需要在delete tensor后面加tensor=nullptr?


chenm_123
2月5日 评论:
2月5日 评论:
当前该接口的实现为:
void MSTensor::DestroyTensorPtr(MSTensor *tensor) noexcept { if (tensor != nullptr) { delete tensor; } }你意思是需要在
delete tensor后面加tensor=nullptr?
是的,不然就明确说明下tensor需要手动置空


YeFeng_24
2月6日 评论:
2月6日 评论:
当前该接口的实现为:
void MSTensor::DestroyTensorPtr(MSTensor *tensor) noexcept { if (tensor != nullptr) { delete tensor; } }你意思是需要在
delete tensor后面加tensor=nullptr?是的,不然就明确说明下tensor需要手动置空
这个我们咋子MindSpore Lite 2.9.0的版本修复一下


3月11日 关闭了 issue
3月11日 issue状态由 WIP 改变为 DONE
📚 文档问题描述
https://www.mindspore.cn/lite/api/zh-CN/master/generate/classmindspore_MSTensor.html#destroytensorptr
DestroyTensorPtr封装函数,实际只实现了delete tensor指针,但是没有进行指针置空,资料也没有需要手动置空指针相关说明。这就会导致销毁tensor后,再次推理新的语音时,复用之前的tensor指针会出现令人迷惑的内存错误。
改进与修复建议
建议二选一:
1.DestroyTensorPtr函数资料添加需要手动置空指针说明。
2.DestroyTensorPtr函数中封装指针置空操作。
版本信息
所有版本均存在
Thanks for contributing 🎉!