Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OPTHREE
Paddle
提交
9ff989ae
P
Paddle
项目概览
OPTHREE
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
9ff989ae
编写于
1月 14, 2022
作者:
石
石晓伟
提交者:
GitHub
1月 14, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove interface: DenseTensor::release, test=develop (#38937)
上级
158bf13f
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
3 addition
and
18 deletion
+3
-18
paddle/fluid/pybind/eager_method.cc
paddle/fluid/pybind/eager_method.cc
+1
-1
paddle/pten/api/lib/utils/tensor_utils.cc
paddle/pten/api/lib/utils/tensor_utils.cc
+2
-4
paddle/pten/core/dense_tensor.h
paddle/pten/core/dense_tensor.h
+0
-6
paddle/pten/tests/core/test_dense_tensor.cc
paddle/pten/tests/core/test_dense_tensor.cc
+0
-7
未找到文件。
paddle/fluid/pybind/eager_method.cc
浏览文件 @
9ff989ae
...
...
@@ -189,7 +189,7 @@ static PyObject* eager_tensor__clear_gradient(EagerTensorObject* self,
<<
" is initialized, will be released."
;
auto
dense_tensor
=
std
::
dynamic_pointer_cast
<
pten
::
DenseTensor
>
(
grad
->
impl
());
dense_tensor
->
release
();
dense_tensor
->
MoveMemoryHolder
();
}
Py_INCREF
(
Py_None
);
return
Py_None
;
...
...
paddle/pten/api/lib/utils/tensor_utils.cc
浏览文件 @
9ff989ae
...
...
@@ -306,10 +306,8 @@ void MovesStorage(pten::DenseTensor* src, paddle::framework::Tensor* dst) {
"The destination Tensor is nullptr when move storage."
));
dst
->
Resize
(
src
->
dims
());
dst
->
set_type
(
pten
::
TransToProtoVarType
(
src
->
dtype
()));
auto
storage
=
src
->
release
();
std
::
shared_ptr
<
pten
::
Allocation
>
holder
(
new
TensorStorage
(
std
::
move
(
storage
)));
dst
->
ResetHolderWithType
(
holder
,
pten
::
TransToProtoVarType
(
src
->
dtype
()));
auto
storage
=
src
->
MoveMemoryHolder
();
dst
->
ResetHolderWithType
(
storage
,
pten
::
TransToProtoVarType
(
src
->
dtype
()));
dst
->
set_offset
(
src
->
meta
().
offset
);
}
...
...
paddle/pten/core/dense_tensor.h
浏览文件 @
9ff989ae
...
...
@@ -172,12 +172,6 @@ class DenseTensor : public TensorBase,
/// \return The actual storage size occupied by tensor.
size_t
capacity
()
const
{
return
storage_
->
size
();
}
/// \brief Release the storage area for other purposes. Because of the
/// destruction of encapsulation, we do not support two dense tensors directly
/// sharing the same intrusive pointer.
/// \return The rvalue of instrusize pointer releated to the released storage.
intrusive_ptr
<
Storage
>
release
()
{
return
std
::
move
(
storage_
);
}
/// \brief Get the mutable data pointer value of type T.
/// Memory allocation may occur when calling this interface:
/// 1. When the storage size is not enough to meet the current shape of the
...
...
paddle/pten/tests/core/test_dense_tensor.cc
浏览文件 @
9ff989ae
...
...
@@ -116,9 +116,6 @@ TEST(dense_tensor, resize) {
CHECK_EQ
(
tensor_0
.
capacity
(),
6u
);
tensor_0
.
mutable_data
<
int8_t
>
();
CHECK_EQ
(
tensor_0
.
capacity
(),
6u
);
auto
storage
=
tensor_0
.
release
();
CHECK_EQ
(
storage
->
size
(),
6u
);
}
TEST
(
dense_tensor
,
shallow_copy
)
{
...
...
@@ -133,10 +130,6 @@ TEST(dense_tensor, shallow_copy) {
DenseTensor
tensor_1
(
tensor_0
);
CHECK
(
tensor_0
.
meta
()
==
tensor_1
.
meta
());
// Copy constructor: Now shares the underlying shared_ptr<Allocation> instead
// of Storage
CHECK
(
tensor_0
.
release
()
!=
tensor_1
.
release
());
}
}
// namespace tests
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录