Closed borgesa closed 5 years ago
The third example model.eval()
seems to have nothing to do with this issue.
The eval()
discouraged to use may refer to the first and second, which changes string into the variable handle. I don't understand how this can be dangerous but I felt this uncomfortable since the linter always complains about that. Maybe I can study this later. I will post some references here, if I find.
I think we can just replace the eval()
with use of dictionary of function handles.
From now on, it seems that simple usage of eval()
just like ours has no problem.
Here is reference
Thanks, will look into that.
I have changed train.py to use neither eval(), wildcard import nor external get_something methods with use of getattr()
. Closing this issue.
Hi,
While I was trying to figure out how to both enable users to use both "PyTorch" loss functions and custom loss functions (ref. pull request #22), I was made aware that usage of eval often is discouraged and can even be dangerous (if abused).
Therefore, I propose that we replace the three instances of it in this repository: model.py:
metric.py
trainer.py
I am not certain about what to replace it with. Any of you know?