def plot_layers(weights, tied_weights=False, channels=<NUM_LIT:1>):
if hasattr(weights[<NUM_LIT:0>], '<STR_LIT>'):<EOL><INDENT>weights = [w.get_value() for w in weights]<EOL><DEDENT>k = min(len(weights), <NUM_LIT:9>)<EOL>imgs = np.eye(weights[<NUM_LIT:0>].shape[<NUM_LIT:0>])<EOL>for i, weight in enumerate(weights[:-<NUM_LIT:1>]):<EOL><INDENT>imgs = np.dot(weight.T, imgs)<EOL>plot_images(imgs,<EOL><NUM_LIT:100> + <NUM_LIT:10> * k + i + <NUM_LIT:1>,<EOL>channels=channels,<EOL>title='<STR_LIT>'.format(i+<NUM_LIT:1>))<EOL><DEDENT>weight = weights[-<NUM_LIT:1>]<EOL>n = weight.shape[<NUM_LIT:1>] / channels<EOL>if int(np.sqrt(n)) ** <NUM_LIT:2> != n:<EOL><INDENT>return<EOL><DEDENT>if tied_weights:<EOL><INDENT>imgs = np.dot(weight.T, imgs)<EOL>plot_images(imgs,<EOL><NUM_LIT:100> + <NUM_LIT:10> * k + k,<EOL>channels=channels,<EOL>title='<STR_LIT>'.format(k))<EOL><DEDENT>else:<EOL><INDENT>plot_images(weight,<EOL><NUM_LIT:100> + <NUM_LIT:10> * k + k,<EOL>channels=channels,<EOL>title='<STR_LIT>')<EOL><DEDENT>
Create a plot of weights, visualized as "bottom-level" pixel arrays.