masahi opened a new pull request, #14797: URL: https://github.com/apache/tvm/pull/14797
As discussed in https://github.com/pytorch/pytorch/issues/99803, as of PT 1.13, PT started to fill in a stride with 1 whenever the corresponding shape axis has size 1 during PT tensor to DLPack conversion. This breaks `tvm.runtime.ndarray.from_dlpack` when the shape is like `(1, 77)` (clip for SD) or whenever the batch size is 1 in vision models. So this is going to be a common problem that people would encounter in practice (see https://discuss.tvm.apache.org/t/a-pytorch-and-tvm-version-incompatibility-problem-while-using-from-dlpack-and-to-dlpack/14771). This PR fixes this issue by relaxing the runtime stride check. An alternative is to modify the strides during `from_dlpack`, but since PT introduced this change for a good reason, I felt that trying to calculate the "correct" strides on our side again is not a good idea. @tqchen @junrushao -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
