NVIDIA / sentiment-discovery

Unsupervised Language Modeling at scale for robust sentiment classification
Other
1.06k stars 202 forks source link

undefined name 'output' #8

Closed cclauss closed 6 years ago

cclauss commented 6 years ago

flake8 testing of https://github.com/NVIDIA/sentiment-discovery on Python 2.7.14

$ flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics

./sentiment_discovery/model/sequence_model.py:219:35: F821 undefined name 'output'
                    output = _output*dont_mask + output*(1 - dont_mask)
                                  ^
raulpuric commented 6 years ago

Hi, that's actually correct. output isn't defined until the first time step completes. We have the correct logic to check for this.

if t != 0:
    output = _output*dont_mask + output*(1 - dont_mask)
else:
    output = _output