This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:20.04 | |
ARG UID=1000 | |
ARG GID=1000 | |
ENV USER rust | |
ENV HOME /home/$USER | |
ENV PATH "$HOME/.cargo/bin:$PATH" | |
WORKDIR /tmp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OBJDIR = bin | |
DEPDIR = deps | |
DEPFLAGS = -MT $@ -MMD -MP -MF $(DEPDIR)/$*.d | |
src = $(wildcard src/*.cc) | |
obj = $(src:src/%.cc=$(OBJDIR)/%.o) | |
DEPFILES = $(src:src/%.cc=$(DEPDIR)/%.d) | |
# if boost is correctly installed, no need to add pathes to |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:18.04 | |
ENV USER mpitest | |
ENV HOME /home/$USER | |
ENV MPI_DIR=/opt/ompi | |
ENV PATH="$MPI_DIR/bin:$HOME/.local/bin:$PATH" | |
ENV LD_LIBRARY_PATH="$MPI_DIR/lib:$LD_LIBRARY_PATH" | |
WORKDIR $HOME | |
RUN apt-get -q update \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Task: convert persistence landscape given in the form (N, k, n, 2) | |
# to its another representation of the shape (N, k, n, p), where N is | |
# the batch size, k - number of feature dimensionalities, n - number of | |
# layers. And the last dimension is 2 dates of event's birth and death | |
# in the former brackets and p is number of discretization steps | |
# in the latter, on the interval where these event dates are defined. | |
import torch | |
import matplotlib.pyplot as plt | |
def triangle_hat(x, a, b): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import scipy.sparse as scsp | |
def GKL_bidiagonalization(A): | |
A = np.matrix(A) | |
m,n = A.shape | |
p = max(m, n) | |
alpha = np.zeros(p) | |
beta = np.zeros(p-1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
def pwCDF(fn, m, interval=(0, 1)): | |
""" | |
fn probability density function | |
m number of intervals at which `fn` is approximated | |
interval `fn`'s domain | |
""" | |
A, B = interval |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def calc_grad_penalty(real_samples, fake_samples, net_D): | |
""" | |
Evaluates gradient penalty for `net_D` and allows other gradients | |
to backpropogate through this penalty term | |
Args: | |
real_samples - a tensor (presumably, without `grad` attribute) | |
fake_samples - tensor of the same shape as `real_samples` tensor | |
net_D - a 'critic' which takes the input of the same shape | |
as `real_samples` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2 | |
import numpy as np | |
def ACD(filename): | |
""" | |
Calculates Average Content Distance for the given short video | |
Parameters: | |
----------- | |
filename : str or path-like - path to .mp4 or .gif file |