Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

export Tensor only to python #5440

Merged
merged 24 commits into from Jul 11, 2021
Merged

export Tensor only to python #5440

merged 24 commits into from Jul 11, 2021

Conversation

lixinqi
Copy link
Contributor

@lixinqi lixinqi commented Jul 9, 2021

不再导出LocalTensor和ConsistentTensor。
只导出基类的Tensor类。

Comment on lines 218 to 219
.def(py::init(&TensorExportUtil<MirroredTensor>::MakeTensor))
.def(py::init(&TensorExportUtil<ConsistentTensor>::MakeTensor))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这两个方法返回的是子类的shared_ptr,python不认识,会出错

#define DEFINE_TENSOR_METHOD(T, type_proto) \
.def("_copy_to_numpy_" #T, &ApiCopyMirroredTensorToNumpy<T>) \
.def("_copy_from_numpy_" #T, &ApiCopyMirroredTensorFromNumpy<T>)
OF_PP_FOR_EACH_TUPLE(DEFINE_TENSOR_METHOD, POD_DATA_TYPE_SEQ)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个 indent 是有意的吗,看着也有些奇怪

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是有意的,因为重新格式化效果不好。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我改回自动格式化吧

oneflow._oneflow_internal.ConsistentTensor,
oneflow._oneflow_internal.LocalTensor,
),
(oneflow._oneflow_internal.ConsistentTensor, oneflow._oneflow_internal.Tensor,),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里的 ConsistentTensor 可以删掉了

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@oneflow-ci-bot oneflow-ci-bot requested review from oneflow-ci-bot and removed request for oneflow-ci-bot July 9, 2021 10:51
@oneflow-ci-bot oneflow-ci-bot requested review from oneflow-ci-bot and removed request for oneflow-ci-bot July 9, 2021 12:31
@clackhan clackhan requested review from oneflow-ci-bot and removed request for oneflow-ci-bot July 9, 2021 16:23
@oneflow-ci-bot oneflow-ci-bot requested review from oneflow-ci-bot and removed request for oneflow-ci-bot July 9, 2021 16:24
@oneflow-ci-bot oneflow-ci-bot removed their request for review July 10, 2021 09:39
@oneflow-ci-bot oneflow-ci-bot self-requested a review July 10, 2021 10:08
@oneflow-ci-bot oneflow-ci-bot requested review from oneflow-ci-bot and removed request for oneflow-ci-bot July 10, 2021 11:40
@oneflow-ci-bot oneflow-ci-bot removed their request for review July 10, 2021 15:08
@oneflow-ci-bot oneflow-ci-bot requested review from oneflow-ci-bot and removed request for oneflow-ci-bot July 10, 2021 15:08
@clackhan clackhan requested review from oneflow-ci-bot and removed request for oneflow-ci-bot July 11, 2021 01:05
@clackhan clackhan requested review from oneflow-ci-bot and removed request for oneflow-ci-bot July 11, 2021 01:08
@oneflow-ci-bot oneflow-ci-bot merged commit da9e9de into master Jul 11, 2021
@oneflow-ci-bot oneflow-ci-bot deleted the refactor_tensor_api branch July 11, 2021 02:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants