metric-learning-divide-and-conquer icon indicating copy to clipboard operation
metric-learning-divide-and-conquer copied to clipboard

Undefined name '_sz_features' in ./lib/model.py

Open cclauss opened this issue 5 years ago • 3 comments

flake8 testing of https://github.com/CompVis/metric-learning-divide-and-conquer on Python 3.7.1

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

./lib/model.py:84:36: F821 undefined name '_sz_features'
        model.sz_features_output = _sz_features[type(model)]
                                   ^
1     F821 undefined name '_sz_features'
1

E901,E999,F821,F822,F823 are the "showstopper" flake8 issues that can halt the runtime with a SyntaxError, NameError, etc. These 5 are different from most other flake8 issues which are merely "style violations" -- useful for readability but they do not effect runtime safety.

  • F821: undefined name name
  • F822: undefined name name in __all__
  • F823: local variable name referenced before assignment
  • E901: SyntaxError or IndentationError
  • E999: SyntaxError -- failed to compile a file into an Abstract Syntax Tree

cclauss avatar Jun 16 '19 20:06 cclauss

it does not matter. The model is only trained on ResNet, so this line is never executed. if type(model) != torchvision.models.ResNet: model.sz_features_output = _sz_features[type(model)] torch.random.manual_seed(config['random_seed'] + 1)

faizwhb avatar Jul 17 '19 15:07 faizwhb

This dead code should be eliminated?

cclauss avatar Jul 17 '19 15:07 cclauss

Agreed.

faizwhb avatar Jul 17 '19 15:07 faizwhb