Skip to content

Instantly share code, notes, and snippets.

View Tenglon's full-sized avatar

Tenglon

  • University of Amsterdam
  • Amsterdam
View GitHub Profile
@Tenglon
Tenglon / ffmpeg_nvidia_conda_install.sh
Last active September 22, 2022 12:22 — forked from kiyoon/ffmpeg_nvidia_conda_install.sh
Install nvidia accelerated ffmpeg in a conda environment.
# CONDA_PREFIX=/var/scratch/tlong/anaconda3/envs/l3
# CONDA_PREFIX=/home/longteng/anaconda3/envs/ptc/
git clone https://git.videolan.org/git/ffmpeg/nv-codec-headers.git
cd nv-codec-headers
vi Makefile # change the first line to PREFIX = ${CONDA_PREFIX}
make install
cd ..
git clone https://git.ffmpeg.org/ffmpeg.git
@Tenglon
Tenglon / torch_jacobian.py
Created November 19, 2021 08:52 — forked from sbarratt/torch_jacobian.py
Get the jacobian of a vector-valued function that takes batch inputs, in pytorch.
def get_jacobian(net, x, noutputs):
x = x.squeeze()
n = x.size()[0]
x = x.repeat(noutputs, 1)
x.requires_grad_(True)
y = net(x)
y.backward(torch.eye(noutputs))
return x.grad.data