def _check_params_all_inited(self, main_program):
    '\n        Check all params from main program are already initialized, see details as follows:\n            1. all parameters in self._params should be type `framework.ParamBase` which are created in dygraph.\n            2. all parameters from transformed program can be found in self._params.\n               Because they share same data with ParamBase of original dygraph.\n        '
    if (not isinstance(self._params, (list, tuple))):
        raise TypeError(('Type of self._params in PartialProgramLayer should be list or tuple, but received %s.' % type(self._params)))
    param_and_buffer_names_set = set()
    for (i, var) in enumerate(self._params):
        if (not isinstance(var, core.VarBase)):
            raise TypeError('Type of self._params[{}] in PartialProgramLayer should be Parameter or Variable, but received {}.'.format(i, type(var)))
        param_and_buffer_names_set.add(var.name)
    for block in main_program.blocks:
        for (name, var) in six.iteritems(block.vars):
            if isinstance(var, framework.Parameter):
                if (name not in param_and_buffer_names_set):
                    raise ValueError(("\n\tWe don't support to define layer with parameters in the function decorated by `@declarative`.\n\tBecause that will re-defined parameters every time when you run the function.\n\tBut we found parameter(%s) was created in the decorated function.\n\tPlease define the layer with parameters in `__init__` function." % name))
Check all params from main program are already initialized, see details as follows:
    1. all parameters in self._params should be type `framework.ParamBase` which are created in dygraph.
    2. all parameters from transformed program can be found in self._params.
       Because they share same data with ParamBase of original dygraph.
def _check_params_all_inited(self, main_program):
    '\n        Check all params from main program are already initialized, see details as follows:\n            1. all parameters in self._params should be type `framework.ParamBase` which are created in dygraph.\n            2. all parameters from transformed program can be found in self._params.\n               Because they share same data with ParamBase of original dygraph.\n        '
    if (not isinstance(self._params, (list, tuple))):
        raise TypeError(('Type of self._params in PartialProgramLayer should be list or tuple, but received %s.' % type(self._params)))
    param_and_buffer_names_set = set()
    for (i, var) in enumerate(self._params):
        if (not isinstance(var, core.VarBase)):
            raise TypeError('Type of self._params[{}] in PartialProgramLayer should be Parameter or Variable, but received {}.'.format(i, type(var)))
        param_and_buffer_names_set.add(var.name)
    for block in main_program.blocks:
        for (name, var) in six.iteritems(block.vars):
            if isinstance(var, framework.Parameter):
                if (name not in param_and_buffer_names_set):
                    raise ValueError(("\n\tWe don't support to define layer with parameters in the function decorated by `@declarative`.\n\tBecause that will re-defined parameters every time when you run the function.\n\tBut we found parameter(%s) was created in the decorated function.\n\tPlease define the layer with parameters in `__init__` function." % name))