MCPcopy
hub / github.com/tensorlayer/TensorLayer / npz_to_W_pdf

Function npz_to_W_pdf

tensorlayer/files/utils.py:2512–2533  ·  view source on GitHub ↗

r"""Convert the first weight matrix of `.npz` file to `.pdf` by using `tl.visualize.W()`. Parameters ---------- path : str A folder path to `npz` files. regx : str Regx for the file name. Examples --------- Convert the first weight matrix of w1_pre...npz

(path=None, regx='w1pre_[0-9]+\.(npz)')

Source from the content-addressed store, hash-verified

2510
2511# Visualizing npz files
2512def npz_to_W_pdf(path=None, regx='w1pre_[0-9]+\.(npz)'):
2513 r"""Convert the first weight matrix of `.npz` file to `.pdf` by using `tl.visualize.W()`.
2514
2515 Parameters
2516 ----------
2517 path : str
2518 A folder path to `npz` files.
2519 regx : str
2520 Regx for the file name.
2521
2522 Examples
2523 ---------
2524 Convert the first weight matrix of w1_pre...npz file to w1_pre...pdf.
2525
2526 >>> tl.files.npz_to_W_pdf(path='/Users/.../npz_file/', regx='w1pre_[0-9]+\.(npz)')
2527
2528 """
2529 file_list = load_file_list(path=path, regx=regx)
2530 for f in file_list:
2531 W = load_npz(path, f)[0]
2532 logging.info("%s --> %s" % (f, f.split('.')[0] + '.pdf'))
2533 visualize.draw_weights(W, second=10, saveable=True, name=f.split('.')[0], fig_idx=2012)
2534
2535
2536def tf_variables_to_numpy(variables):

Callers

nothing calls this directly

Calls 2

load_file_listFunction · 0.85
load_npzFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…