Keraflow
Deep Learning for Python.
 All Classes Namespaces Functions Pages
keraflow.utils.user_input_utils.UserInput Class Reference

Utility class for flexible user input assiging optimizers, regularizers, numpy input... More...

Inheritance diagram for keraflow.utils.user_input_utils.UserInput:

Public Member Functions

def __init__
 
def __call__
 

Detailed Description

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"

Constructor & Destructor Documentation

def keraflow.utils.user_input_utils.UserInput.__init__ (   self,
  legal_names 
)
Parameters
legal_nameslist 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.).

Member Function Documentation

def keraflow.utils.user_input_utils.UserInput.__call__ (   self,
  user_input,
  array = False,
  allow_missing = False,
  no_single_value = True,
  error_context = '' 
)
Parameters
user_inputdict/list/single object(s)
arrayboolean. 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_missingFalse 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_valueboolean. Whether user_input could be a single value
error_contextstr. Debug messages when user_ipnut is not acceptable.
Returns
list of values (allow_missing=False) or list of (name, value) tuples (otherwise).