Efficient dot products of large memory-mapped arrays

I’ve implemented a function for applying np.dot to blocks that are explicitly read into core memory from the memory-mapped array: import numpy as np def _block_slices(dim_size, block_size): “””Generator that yields slice objects for indexing into sequential blocks of an array along a particular axis “”” count = 0 while True: yield slice(count, count + block_size, … Read more

How to reduce a fully-connected (`”InnerProduct”`) layer using truncated SVD

Some linear-algebra background Singular Value Decomposition (SVD) is a decomposition of any matrix W into three matrices: W = U S V* Where U and V are ortho-normal matrices, and S is diagonal with elements in decreasing magnitude on the diagonal. One of the interesting properties of SVD is that it allows to easily approximate … Read more