metric-learning-divide-and-conquer
metric-learning-divide-and-conquer copied to clipboard
Undefined name '_sz_features' in ./lib/model.py
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
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)
This dead code should be eliminated?
Agreed.