NotImplementError while inspecting PyTorch nn model

I’m trying to inspect the model(PyTorch) but it shows the following error!

Unable to display children:Error resolving variables Traceback (most recent call last):
  File "D:\Program Files\JetBrains\PyCharm 2019.2.3\plugins\python\helpers\pydev\_pydevd_bundle\pydevd_comm.py", line 1208, in do_it
    xml.write(pydevd_xml.var_to_xml(val, k, evaluate_full_value=evaluate_full_value))
  File "D:\Program Files\JetBrains\PyCharm 2019.2.3\plugins\python\helpers\pydev\_pydevd_bundle\pydevd_xml.py", line 369, in var_to_xml
    elif hasattr(v, "__len__") and not is_string(v):
  File "D:\Anaconda3\envs\pt37\lib\site-packages\torch\nn\backends\backend.py", line 10, in __getattr__
    raise NotImplementedError
NotImplementedError

How should I implement the __getattr__ method here?

1 Like

It seems var_to_xml expects a __len__ method of the inspected object, which is not implemented for classes of nn.Module.

I also have that problem when trying to inspect an instance of torch.nn.Module in PyCharm’s debugger. How to resolve?

Please can someone offer a solution. This is driving me nuts.

I am also facing the same issue. I want check Pytorch model and model layers’ info. But we cannot see it using Pycharm debugger. Any one has good solutions on it, please?