MCPcopy Create free account
hub / github.com/pytorch/tutorials / attribute

Function attribute

intermediate_source/memory_format_tutorial.py:362–373  ·  view source on GitHub ↗
(m)

Source from the content-addressed store, hash-verified

360
361
362def attribute(m):
363 old_attrs[m] = dict()
364 for i in dir(m):
365 e = getattr(m, i)
366 exclude_functions = ["is_cuda", "has_names", "numel", "stride", "Tensor", "is_contiguous", "__class__"]
367 if i not in exclude_functions and not i.startswith("_") and "__call__" in dir(e):
368 try:
369 old_attrs[m][i] = e
370 setattr(m, i, check_wrapper(e))
371 except Exception as e:
372 print(i)
373 print(e)
374
375
376attribute(torch.Tensor)

Callers 1

Calls 1

check_wrapperFunction · 0.85

Tested by

no test coverage detected