Skip to content

Conversation

@masahi
Copy link
Member

@masahi masahi commented Jun 21, 2023

Currently, NDArray::CreateView(...) requires the strides of the input array to be null. This makes it impossible to apply, for example, reshaping on an array which originally comes from PyTorch via from_dlpack.

This PR relaxes the null check to allow non-null strides, as long as they are "compact". But after creating a view, the returned array no longer has strides.

This is a subset of new functionalities from another PR #14771, which ended up causing disruptive changes across the stack.

@Lunderberg @tqchen @vinx13 @yelite @sunggg

@tvm-bot
Copy link
Collaborator

tvm-bot commented Jun 21, 2023

Thanks for contributing to TVM! Please refer to the contributing guidelines https://tvm.apache.org/docs/contribute/ for useful information and tips. Please request code reviews from Reviewers by @-ing them in a comment.

  • No users to tag found in teams: ndarray See #10317 for details

Generated by tvm-bot

@masahi masahi changed the title [NDArray] Allow creating a view from a stride array [NDArray] Allow creating a view from a strided array Jun 21, 2023
Copy link
Contributor

@Lunderberg Lunderberg left a comment

Choose a reason for hiding this comment

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

The changes look good, and it makes sense to split out the utility from the more disruptive parts of #14771.

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

Successfully merging this pull request may close these issues.

4 participants