[WIP] Unwrap View in Reinterpret View (#89016)

Pull Request resolved: https://github.com/pytorch/pytorch/pull/89016
Approved by: https://github.com/ngimel
This commit is contained in:
Elias Ellison 2022-11-15 00:21:52 +00:00 committed by PyTorch MergeBot
parent dd6beca854
commit 73d71ae3d6

View file

@ -998,11 +998,11 @@ def as_storage_and_layout(x, freeze=True, want_contiguous=False, stride_order=No
x.data.decide_layout()
return x, x.data.layout
if isinstance(x, ReinterpretView):
# making the base of x contiguous or stride_ordered will not necessarily make
# the ReinterpretedView either, so dont pass along those arguments
buffer, _ = as_storage_and_layout(
x.data,
freeze=freeze,
want_contiguous=want_contiguous,
stride_order=stride_order,
)
return buffer, x.layout
raise NotImplementedError
@ -1402,6 +1402,10 @@ class ReinterpretView(BaseView):
layout: "Layout"
def __post_init__(self):
if isinstance(self.data, BaseView):
self.data = self.data.unwrap_view()
def __str__(self):
return self.str_helper(
[