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
Conversation
.def(py::init(&TensorExportUtil<MirroredTensor>::MakeTensor)) | ||
.def(py::init(&TensorExportUtil<ConsistentTensor>::MakeTensor)) |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个 indent 是有意的吗,看着也有些奇怪
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
是有意的,因为重新格式化效果不好。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我改回自动格式化吧
oneflow/python/framework/tensor.py
Outdated
oneflow._oneflow_internal.ConsistentTensor, | ||
oneflow._oneflow_internal.LocalTensor, | ||
), | ||
(oneflow._oneflow_internal.ConsistentTensor, oneflow._oneflow_internal.Tensor,), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里的 ConsistentTensor 可以删掉了
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好
…into refactor_tensor_api
…oneflow into refactor_tensor_api
fix bug
fix bug
fix bug
不再导出LocalTensor和ConsistentTensor。
只导出基类的Tensor类。