Skip to content

Reenable memory format tutorial #3350

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

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .jenkins/validate_tutorials_built.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@
"intermediate_source/text_to_speech_with_torchaudio",
"intermediate_source/tensorboard_profiler_tutorial", # reenable after 2.0 release.
"advanced_source/semi_structured_sparse", # reenable after 3303 is fixed.
"intermediate_source/torchrec_intro_tutorial", # reenable after 3302 is fixe
"intermediate_source/memory_format_tutorial", # causes other tutorials like torch_logs fail. "state" issue, reseting dynamo didn't help
"intermediate_source/torchrec_intro_tutorial" # reenable after 3302 is fixe
]

def tutorial_source_dirs() -> List[Path]:
Expand Down
28 changes: 17 additions & 11 deletions intermediate_source/memory_format_tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,23 +358,29 @@ def attribute(m):
print(e)


attribute(torch.Tensor)
attribute(torch.nn.functional)
attribute(torch)

#############################
# To debug which operators don't support channels last format, execute
# the following lines:
#
# .. code-block:: python
#
# attribute(torch.Tensor)
# attribute(torch.nn.functional)
# attribute(torch)
#

######################################################################
# If you found an operator that doesn't support channels last tensors
# and you want to contribute, feel free to use following developers
# guide https://github.com/pytorch/pytorch/wiki/Writing-memory-format-aware-operators.
# and you want to contribute, see following developers
# `Writing Memory Format Aware Operators <https://github.com/pytorch/pytorch/wiki/Writing-memory-format-aware-operators>`__.
#

######################################################################
# Code below is to recover the attributes of torch.

for (m, attrs) in old_attrs.items():
for (k, v) in attrs.items():
setattr(m, k, v)
# The code below is to recover the attributes of torch.
#
# for (m, attrs) in old_attrs.items():
# for (k, v) in attrs.items():
# setattr(m, k, v)

######################################################################
# Work to do
Expand Down