"git@developer.sourcefind.cn:renzhc/diffusers_dcu.git" did not exist on "648d968cfc69074eaf51df3d337100f9805b030e"
Unverified Commit 1947d87d authored by Xin Yao's avatar Xin Yao Committed by GitHub
Browse files

fix unpinning when tensoradaptor is not available (#4450)

parent 7a41c126
...@@ -67,7 +67,8 @@ struct NDArray::Internal { ...@@ -67,7 +67,8 @@ struct NDArray::Internal {
ptr->mem = nullptr; ptr->mem = nullptr;
} else if (ptr->dl_tensor.data != nullptr) { } else if (ptr->dl_tensor.data != nullptr) {
// if the array is still pinned before freeing, unpin it. // if the array is still pinned before freeing, unpin it.
UnpinContainer(ptr); if (ptr->pinned_by_dgl_)
UnpinContainer(ptr);
dgl::runtime::DeviceAPI::Get(ptr->dl_tensor.ctx)->FreeDataSpace( dgl::runtime::DeviceAPI::Get(ptr->dl_tensor.ctx)->FreeDataSpace(
ptr->dl_tensor.ctx, ptr->dl_tensor.data); ptr->dl_tensor.ctx, ptr->dl_tensor.data);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment