Repo collecting some common tools for pytorch and numpy. Changed the name to これと, kore to, "this and..." to reflect the incomplete nature of this project.
ObjDict()
class, thin wrap on Dict for accessing keys as object attributes, with rw to yaml and json
sround()
'smart round', to highest digits, inputs float or list, tuple, ndarray
filter_kwargs
filters kwarg dict to pass to callable
deepclone()
similar to deepcopy, clone and detach torch tensors to cpu
get_files()
get files from folder, optionally recursive, sorted
randitem()
get random item from a sequence
get_images()
get images, shortcut to get files with image formats accessible from PIL
hash_file()
returns a dictionary with md5 hash of date and file content
Plog()
class, running log to collect to pandas csv
Col()
class, color print codes
@memory_profiler
decorator class using digest of nvml, torch.profiler and torch.cuda.memory_stats()
GPUse()
class, thin wrap around nvidia-smi
CPUse()
class, thin wrap around psutil.virtualmemory
ObjTrace()
class, GPU and CPU collection based on ObjDict
Schedule()
scheduler class, linear, exponential, with noisy periodic functions
mgrid()
fast n dim meshgrid with layout and column order options (torch | numpy)
mgrid_pos()
grid indices (torch | numpy)
unique_randint()
non repeating random ints (torch | numpy)
@contiguous(msg)
decorator that ensure contiguous tensor or tensor tuple outputs, msg optional
unsqueeze_to
unsqueeze as many steps as required to match tensor.ndim or int
extend_to
add trailing dimensions for as many steps as required to match tensor.ndim or int
pytorch only, partial port from nerfies jax code
pixels_to_rays()
pixels to rays given camera intrinsics
points_to_pixels()
pixels to rays given camera intrinsics
rotate_rays()
rotate rays by transform
Camera()
camera class, io, intrinsics, extrinsics
pytorch only,
esd(tensor)
Empirical Spectral Distribution of a tensor (binned eigen values)
get_esds(model, name='weight')
given a model returns list of (name, ESD, shape)
plot_esds(model, name='weight')
given a model, plots ESDs of weight parameters
pca
Principal Component Analysis of tensor
kde
Gaussian Kernel Density Estimation of tensor
get_conv_zero_kernels(nn.Module)
Identifies conv kernels where all weights are below threshold