PS C:\yk_repo\yk_coding\pycallgraph2> python
Python 3.10.11 (tags/v3.10.11:7d4cc5a, Apr 5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
import torch
=====the pytorch is fine!!!!!
then I run:
from pycallgraph2 import PyCallGraph
from pycallgraph2.output import GraphvizOutput
with PyCallGraph(output=GraphvizOutput()):
#code to profile
import torch
''' tested with pytorch 2.0.0 and 1.13.1
PS C:\yk_repo\yk_coding\pycallgraph2> python .\demo_pcg2.py
C:\Python310\lib\site-packages\torch\distributed\distributed_c10d.py:283: UserWarning: torch.distributed.reduce_op is deprecated, please use torch.distributed.ReduceOp instead
warnings.warn(
Traceback (most recent call last):
File "C:\yk_repo\yk_coding\pycallgraph2\demo_pcg2.py", line 6, in
import torch
File "C:\Python310\lib\site-packages\torch_init_.py", line 1187, in
from .functional import * # noqa: F403
File "C:\Python310\lib\site-packages\torch\functional.py", line 8, in
import torch.nn.functional as F
File "C:\Python310\lib\site-packages\torch\nn_init_.py", line 1, in
from .modules import * # noqa: F403
File "C:\Python310\lib\site-packages\torch\nn\modules_init_.py", line 2, in
from .linear import Identity, Linear, Bilinear, LazyLinear
File "C:\Python310\lib\site-packages\torch\nn\modules\linear.py", line 7, in
from .. import functional as F
File "C:\Python310\lib\site-packages\torch\nn\functional.py", line 1437, in
VF.threshold,
File "C:\Python310\lib\site-packages\torch_VF.py", line 26, in getattr
def getattr(self, attr):
File "C:\Python310\lib\site-packages\pycallgraph2\tracer.py", line 25, in tracer
self.processor.process(frame, event, self.memory())
File "C:\Python310\lib\site-packages\pycallgraph2\tracer.py", line 171, in process
module_path = module.file
File "C:\Python310\lib\site-packages\torch_VF.py", line 27, in getattr
return getattr(self.vf, attr)
AttributeError: 'torch._C._VariableFunctionsClass' object has no attribute 'file'
'''