def load_and_assign_npz_dict(name='<STR_LIT>', sess=None):
if sess is None:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if not os.path.exists(name):<EOL><INDENT>logging.error("<STR_LIT>".format(name))<EOL>return False<EOL><DEDENT>params = np.load(name)<EOL>if len(params.keys()) != len(set(params.keys())):<EOL><INDENT>raise Exception("<STR_LIT>" % name)<EOL><DEDENT>ops = list()<EOL>for key in params.keys():<EOL><INDENT>try:<EOL><INDENT>varlist = tf.get_collection(tf.GraphKeys.GLOBAL_VARIABLES, scope=key)<EOL>if len(varlist) > <NUM_LIT:1>:<EOL><INDENT>raise Exception("<STR_LIT>" % key)<EOL><DEDENT>elif len(varlist) == <NUM_LIT:0>:<EOL><INDENT>raise KeyError<EOL><DEDENT>else:<EOL><INDENT>ops.append(varlist[<NUM_LIT:0>].assign(params[key]))<EOL>logging.info("<STR_LIT>" % key)<EOL><DEDENT><DEDENT>except KeyError:<EOL><INDENT>logging.info("<STR_LIT>" % key)<EOL><DEDENT><DEDENT>sess.run(ops)<EOL>logging.info("<STR_LIT>" % name)<EOL>
Restore the parameters saved by ``tl.files.save_npz_dict()``.

    Parameters
    ----------
    name : str
        The name of the `.npz` file.
    sess : Session
        TensorFlow Session.