""" this module provides 'register' for registering customized layers"""g_custom_layers={}defregister(kind,shape,layer):""" register a custom layer or a list of custom layers Args: @kind (str or list): type name of the layer @shape (function): a function to generate the shape of layer's output @layer (function): a function to generate the shape of layer's output Returns: None """asserttype(shape).__name__=='function','shape should be a function'asserttype(layer).__name__=='function','layer should be a function'iftype(kind)isstr:kind=[kind]else:asserttype(kind)islist,'invalid param "kind" for register, not a list or str'forkinkind:asserttype(k)isstr,'invalid param "kind" for register, not a list of str'assertknoting_custom_layers,'this type[%s] has already been registered'%(k)print('register layer[%s]'%(k))g_custom_layers[k]={'shape':shape,'layer':layer}defget_registered_layers():returng_custom_layers