d2l-ai / d2l-en

Interactive deep learning book with multi-framework code, math, and discussions. Adopted at 500 universities from 70 countries including Stanford, MIT, Harvard, and Cambridge.
https://D2L.ai
Other
23.92k stars 4.36k forks source link

Undefined name: 'vocab' in mxnet.py #948

Closed cclauss closed 4 years ago

cclauss commented 4 years ago

@astonzhang https://github.com/d2l-ai/d2l-en/blob/master/d2l/mxnet.py#L2222-L2223 on these lines vocab is an undefined name.

flake8 testing of https://github.com/d2l-ai/d2l-en on Python 3.8.3

$ flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics

./d2l/mxnet.py:2222:24: F821 undefined name 'vocab'
    premise = np.array(vocab[premise], ctx=d2l.try_gpu())
                       ^
./d2l/mxnet.py:2223:27: F821 undefined name 'vocab'
    hypothesis = np.array(vocab[hypothesis], ctx=d2l.try_gpu())
                          ^
2     F821 undefined name 'vocab'
2

https://flake8.pycqa.org/en/latest/user/error-codes.html

On the flake8 test selection, this PR does not focus on "style violations" (the majority of flake8 error codes that psf/black can autocorrect). Instead these tests are focus on runtime safety and correctness:

goldmermaid commented 4 years ago

Hi thanks for raising the issue. I had a PR https://github.com/d2l-ai/d2l-en/pull/951.

xiaotinghe commented 4 years ago

PR #953

astonzhang commented 4 years ago

Thanks @goldmermaid and @xiaotinghe . It's fixed now.

cclauss commented 4 years ago

Fixed in #953