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

Reshape creates a copy of the data but shouldn't #383

Open
tgkolda opened this issue Jan 1, 2025 · 0 comments
Open

Reshape creates a copy of the data but shouldn't #383

tgkolda opened this issue Jan 1, 2025 · 0 comments

Comments

@tgkolda
Copy link
Collaborator

tgkolda commented Jan 1, 2025

The method tensor.reshape should not make a deep copy of the data. Either reshape should change the tensor it's called on, or it should be a function rather than a method. In numpy, the default behavior of reshape is that it returns a view (if possible, depending on the order). I think we get in trouble because we then call the tensor constructor which makes a copy. We need an option to not make a copy. Ideally, we can have two tensors with different shapes that share the same underlying data, but this needs to be clear so that the user knows when they have a view versus a copy.

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

1 participant