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

How to convert mindspore.common._stub_tensor.StubTensor to mindspore.common.tensor.Tensor? #322

Open
psychedelicosisyphus opened this issue Dec 31, 2024 · 1 comment

Comments

@psychedelicosisyphus
Copy link

Environment

Hardware Environment(Ascend):

910B4

Software Environment:

mindspore == 2.3.0
python == 3.10.0

##Why does the variable become a placeholder mindspore.common._stub_tensor.StubTensor after calculating with ops.mul, and how can I convert it back to a regular mindspore.common.tensor.Tensor?
1
2

@zhouyifeng888
Copy link

This StubTensor doesn't actually need to be converted into a Tensor. It can be used as a Tensor during the process, and the framework will handle it internally. StubTensor is designed as a data type for host asynchronous dispatching in dynamic graphs. Apart from the difference in type, it functions the same as a Tensor. The main purpose of StubTensor is to reduce the overhead on the host side and solve the conversion overhead between Python and native.
If an error occurs, it may be caused by other reasons. You can enable the synchronous mode of the dynamic graph in the context, which might provide more accurate and detailed information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants