This file contains 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 torch | |
from torch import Tensor | |
from torch.testing import assert_close | |
def fft(tensor: Tensor, pi: Tensor = torch.acos(torch.tensor(-1.))) -> Tensor: | |
n = tensor.size()[-1] | |
index = torch.arange(n, dtype=torch.float32) | |
fourier = torch.exp(index[:, None] * index[None, :] * pi * -2j / n) |
This file contains 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 math | |
import torch | |
from torch import Tensor | |
from torch import nn | |
from torch.nn import functional as F | |
from torch.nn import init | |
class ComplexLinear(nn.Module): |
This file contains 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
# CUDA | |
export CUDA_HOME=/usr/local/cuda-9.0 | |
export CUDA_ROOT=/usr/local/cuda-9.0 | |
export CUDA_PATH=/usr/local/cuda-9.0 | |
export PATH=${CUDA_HOME}/bin:${PATH} | |
export LIBRARY_PATH=${CUDA_HOME}/lib64:${LIBRARY_PATH} | |
export LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH} | |
# cuDNN |
This file contains 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
pip | |
wheel | |
setuptools | |
cython | |
numpy | |
scipy | |
matplotlib | |
pandas | |
gensim | |
sklearn |
This file contains 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
% lstlisting coq style (inspired from https://github.com/cmc333333/forensics-thesis) | |
% lstlisting coq style (inspired from a file of Assia Mahboubi) | |
% | |
\lstdefinelanguage{coq}{ | |
% | |
% Anything betweeen $ becomes LaTeX math mode | |
mathescape=true, | |
% | |
% Comments may or not include Latex commands | |
texcl=false, |
This file contains 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 chainer.functions as F | |
import numpy as np | |
from chainer import Variable, Function | |
from chainer import cuda | |
class Scatter(Function): | |
def __init__(self, row: int, col: int): | |
self.row = row | |
self.col = col |
This file contains 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
#include <iostream> | |
using namespace std; | |
int binary_search(int *a, int value, int left, int right) { | |
if (left >= right) return -1; | |
else { | |
int mid = (left + right) / 2; | |
if (a[mid] == value) return mid; | |
else if (a[mid] > value) return binary_search(a, value, left, mid); |
This file contains 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 tensorflow as tf | |
class Summary(object): | |
def __init__(self, logdir: str): | |
self._placeholders = {} | |
self._observations = {} | |
self._session = tf.Session() | |
self._writer = tf.summary.FileWriter(logdir=logdir) |
This file contains 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 chainer import Chain, report | |
class MultiTaskClassifier(Chain): | |
def __init__(self, task1, task2, loss1, loss2, acc1, acc2, lambda_=1.0): | |
""" | |
:param task1: `Chain` of task 1 | |
:param task2: `Chain` of task 2 | |
:param loss1: loss function of task1 | |
:param loss2: loss function of task2 |
NewerOlder