lspci | grep -i nvidia
cat /proc/driver/nvidia/version
def bjac(gy, y): | |
""" | |
Get the batched Jacobian matrix for vector-valued output, gy, with respect to the input, y. | |
The Jacobian output will take shape of (nbatch, *gy.shape[1:], *y.shape[1:]) | |
""" | |
# reshape gy to be batched 1D vector | |
ggy = gy.view(gy.shape[0], -1) | |
outshape = (gy.shape[0], *gy.shape[1:], *y.shape[1:]) | |
nbatch, nfout = ggy.shape |
import torch | |
class eig(torch.autograd.Function): | |
@staticmethod | |
def forward(ctx, A): | |
# normalize the shape to be batched | |
Ashape = A.shape | |
if A.ndim == 2: | |
A = A.unsqueeze(0) | |
elif A.ndim > 3: |
# plot histogram with logscale in the x-axis | |
import numpy as np | |
import matplotlib.pyplot as plt | |
def plot_loghist(x, bins=30, **hist_kwargs): | |
hist, bins = np.histogram(x, bins=bins) | |
logbins = np.logspace(np.log10(bins[0]),np.log10(bins[-1]),len(bins)) | |
plt.hist(x, bins=logbins, **hist_kwargs) | |
plt.xscale('log') | |
# silencing loud third-party library |
""" | |
Gradph object can be used to debug multi-level autograd for anomaly detection. | |
To see an example on how to use this, see the bottom of this script. | |
""" | |
import torch | |
class GradphNode(object): | |
def __init__(self, gfn, parent_node): | |
self._gfn = gfn |
These are the git commands I usually use (for self-reminder), sorted from the most-used ones:
git status
: to see the statesgit log --oneline
: to see which commit I'm atgit add <filename(s)>
: to stage a file(s)git commit -m "<Some message>"
: to make a commitgit push
: push the latest update to the remotegit pull
: pull the latest states from the remotegit clone <repo_url>
: clone a new repositorygit diff
: to see which lines in the file that haven't been staged// g++ -O2 div-avx.cc -I/home/muhammad/libs/sleef/include/ -mavx -L/home/muhammad/libs/sleef/lib/ -lsleef | |
#include <immintrin.h> | |
#include <sleef.h> | |
#include <chrono> | |
#include <iostream> | |
#include <iomanip> | |
#include <cmath> | |
#include <complex> |