TylerYep / torchinfo

View model summaries in PyTorch!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

incosistent behaviour on ptpython

Freed-Wu opened this issue · comments

commented

Describe the bug

from torchvision.models import resnet18
from torchinfo import summary
model = resnet18()
a = summary(model, (1, 3, 256, 256))

In python, ipython, this code will not output anything, however, in ptpython, it will output a.

Expected behavior
in any REPL of python, it shouldn't output.

Screenshots
screen-2023-01-24-02-21-25

ptpython: 3.0.21
python: 3.10.9
torchinfo: 1.7.1

Additional context
Add any other context about the problem here.

commented

Oh, it looks related to sys.ps1.

commented

This code use sys.ps1 to detect if it is a REPL, however, python and ipython assign sys.ps1 while ptpython not.