Keraflow
Deep Learning for Python.
|
Utility class for flexible user input assiging optimizers, regularizers, numpy input... More...
Public Member Functions | |
def | __init__ |
def | __call__ |
Utility class for flexible user input assiging optimizers, regularizers, numpy input...
To bring both flexibly and convince to argument passing in Keraflow, for some arguments of some functions, users can pass a single value, a dictionary, or a list. We normalize the input to an ordered list of arrays (same order as legal_names
). For more information, please refer to Argument Passing section of Tutorials"
def keraflow.utils.user_input_utils.UserInput.__init__ | ( | self, | |
legal_names | |||
) |
legal_names | list of str. Ordered target names of user's input, e.g. ['W', 'b'] for setting layer weight or ['output1', 'output2'] for setting outputports' attributes (loss, metric etc.). |
def keraflow.utils.user_input_utils.UserInput.__call__ | ( | self, | |
user_input, | |||
array = False , |
|||
allow_missing = False , |
|||
no_single_value = True , |
|||
error_context = '' |
|||
) |
user_input | dict/list/single object(s) |
array | boolean. Whether each target accepts an numpy array. If only single target, a list is also acceptable. The list well be automatically transformed to a numpy array. |
allow_missing | False or 'skip', 'fill_none'. If False, len(user_inputs) should be equal to len(legal_names). Return list of values If 'skip', return a list of (name, value) tuples, target that is not specified is not returned. If 'fill_none', return a list of (name, value) tuples, target that is not specified is filled with None. |
no_single_value | boolean. Whether user_input could be a single value |
error_context | str. Debug messages when user_ipnut is not acceptable. |
allow_missing
=False) or list of (name, value) tuples (otherwise).