mirror of
https://github.com/saymrwulf/pytorch.git
synced 2026-05-14 20:57:59 +00:00
[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:
parent
dd6beca854
commit
73d71ae3d6
1 changed files with 6 additions and 2 deletions
|
|
@ -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(
|
||||
[
|
||||
|
|
|
|||
Loading…
Reference in a new issue