Closed chris-tkinter closed 3 years ago
This is because strings in types are often used to denote forward references, e.g.
def f(x: "A"): ...
class A: ...
As a result PyCharm is looking for an object called batch
somewhere, and is complaining that it can't find it.
This is essentially a limitation of PyCharm -- it's assuming strings are being used in a way that they're only sometimes used.
One option is to disable the warning, via whatever mechanism PyCharm offers for that. It's been a while since I've used PyCharm but I think you should be able to disable the warning locally, or for the whole file, or globally.
The other option is just to put batch = None
anywhere in the file to fool PyCharm into thinking that something called batch
exists.
Thanks! That makes sense!
Hi, is there any workarounds that does not require disabling linting or creating weird variables? thanks!
Hi, I really like this project! It's mind blowing for me!!
I have a question. When coding in pycharm using
TensorType
with a string dimension name, I got a warning aboutunresolved reference
I am not sure if this is a limitation of pycharm. I am using pycharm 2021.1.1, python 3.7.10 and torchtyping 0.1.4.
Thanks!