Skip to content
Snippets Groups Projects
Commit 4fa5fa92 authored by Guillaume HEUSCH's avatar Guillaume HEUSCH
Browse files

[script] remove the get_parameter function from the train_cnn script

parent fb36d05c
No related branches found
No related tags found
1 merge request!4Resolve "Add GANs"
......@@ -52,48 +52,6 @@ from bob.learn.pytorch.utils import get_parameter
version = pkg_resources.require('bob.learn.pytorch')[0].version
def get_parameter(args, configuration, keyword, default):
""" Get the right value for a parameter
The parameters are either defined in a separate configuration file
or given directly via command-line. Note that the command-line
has priority over the configuration file.
As a convention, parameters made with more than one word (i.e. batch size)
are provided with an underscore in the configuration file, and with an
hyphen in the command-line:
- configuration: batch_size=64
- command line: --batch-size=64
Parameters
----------
args: dictionary
The arguments as parsed from the command line.
configuration: object
The arguments given by the configuration file.
keyword: string
the keyword for the parameter to process (in the "configuration" style)
default:
The default value of the parameter
Returns
-------
arg:
The right value for the given keyword argument
"""
args_kw = '--' + keyword.replace('_', '-')
_type = type(default)
arg = _type(args[args_kw])
if hasattr(configuration, keyword):
arg = getattr(configuration, keyword)
if _type(args[args_kw]) is not default:
arg = _type(args[args_kw])
return arg
def main(user_input=None):
# Parse the command-line arguments
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment