X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=blobdiff_plain;f=stack.py;h=544306c2516307bac6bc47936d96766db8c84400;hb=c17cb30d6d5bfa2f450dd9cc3d2d931fce9cbdab;hp=0838bee9e025340f3058fedb7478ce14200ac788;hpb=3814647c468e48a12543519b7ce7e584936e24ee;p=pytorch.git diff --git a/stack.py b/stack.py index 0838bee..544306c 100755 --- a/stack.py +++ b/stack.py @@ -10,6 +10,11 @@ from torch import Tensor import sys def exception_hook(exc_type, exc_value, tb): + r'''Hacks the call stack message in case of RuntimeError to show all + the local variables, and indicate for every tensor its shape, + dtype and device. + + ''' repr_orig=Tensor.__repr__ Tensor.__repr__=lambda x: f'{x.size()}:{x.dtype}:{x.device}'