Skip to content

Instantly share code, notes, and snippets.

View r9y9's full-sized avatar
:shipit:
( ˘ω˘ ) zzz

Ryuichi Yamamoto r9y9

:shipit:
( ˘ω˘ ) zzz
View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@snowyday
snowyday / eve.py
Last active January 16, 2018 04:26
Eve: Improving Stochastic Gradient Descent with Feedback
import math
from torch.optim import Optimizer
class Eve(Optimizer):
"""Implements Eve (Adam with feedback) algorithm.
It has been proposed in `Improving Stochastic Gradient Descent with Feedback, `_.
Arguments:
params (iterable): iterable of parameters to optimize or dicts defining
@jfsantos
jfsantos / AudioDisplay.jl
Created November 4, 2014 01:10
Rendering audio in IJulia notebooks
using WAV
function inline_audioplayer(filepath)
markup = """<audio controls="controls" {autoplay}>
<source src="$filepath" />
Your browser does not support the audio element.
</audio>"""
display(MIME("text/html") ,markup)
end
@mmohiudd
mmohiudd / facebook-batchcall.php
Created May 8, 2014 22:21
Batch call with facebook-php-sdk-v4
<?php
use Facebook\FacebookSession;
use Facebook\FacebookRequest;
use Facebook\GraphUser;
use Facebook\FacebookRequestException;
FacebookSession::setDefaultApplication('YOUR_APP_ID','YOUR_APP_SECRET');
// Use one of the helper classes to get a FacebookSession object.
// FacebookRedirectLoginHelper
import pyworld as pw
import pysptk
from scipy.io import wavfile
import numpy as np
fs, x = wavfile.read(pysptk.util.example_audio_file())
assert fs == 16000
wavfile.write('./orig.wav', fs, x)
# shortからfloatに変換します
@davidaknowles
davidaknowles / torch_pixel_shuffle1d.py
Created August 20, 2019 19:23
torch currently only supports 2d pixel shuffle from https://arxiv.org/abs/1609.05158. This is the 1d version.
def pixel_shuffle_1d(x, upscale_factor):
batch_size, channels, steps = x.size()
channels //= upscale_factor
input_view = x.contiguous().view(batch_size, channels, upscale_factor, steps)
shuffle_out = input_view.permute(0, 1, 3, 2).contiguous()
return shuffle_out.view(batch_size, channels, steps * upscale_factor)
@xavierd
xavierd / complete.cc
Created December 29, 2010 15:20
Hacking with libclang completion.
#include <clang-c/Index.h>
#include <cstdlib>
#include <iostream>
/*
* Compile with:
* g++ complete.cc -o complete -lclang -L/usr/lib/llvm
* Run with:
* LIBCLANG_TIMING=1 ./complete file.cc line column [clang args...]
*/
@brannondorsey
brannondorsey / pix2pix_paper_notes.md
Last active January 3, 2022 09:57
Notes on the Pix2Pix (pixel-level image-to-image translation) Arxiv paper

Image-to-Image Translation with Conditional Adversarial Networks

Notes from arXiv:1611.07004v1 [cs.CV] 21 Nov 2016

  • Euclidean distance between predicted and ground truth pixels is not a good method of judging similarity because it yields blurry images.
  • GANs learn a loss function rather than using an existing one.
  • GANs learn a loss that tries to classify if the output image is real or fake, while simultaneously training a generative model to minimize this loss.
  • Conditional GANs (cGANs) learn a mapping from observed image x and random noise vector z to y: y = f(x, z)
  • The generator G is trained to produce outputs that cannot be distinguished from "real" images by an adversarially trained discrimintor, D which is trained to do as well as possible at detecting the generator's "fakes".
  • The discriminator D, learns to classify between real and synthesized pairs. The generator learns to fool the discriminator.
  • Unlike an unconditional GAN, both th
@taroushirani
taroushirani / spsvsmod.py
Created May 3, 2022 07:30
CLI for NNSVS packed model
#! /usr/bin/python
import argparse
import logging
from nnmnkwii.io import hts
from nnsvs.dsp import bandpass_filter
from nnsvs.gen import (
gen_spsvs_static_features,
gen_world_params,
postprocess_duration,
@gwtaylor
gwtaylor / crbm.py
Last active August 9, 2022 15:13
Theano CRBM demonstration
""" Theano CRBM implementation.
For details, see:
Taylor GW, Hinton GE, Roweis ST. Modeling Human Motion Using Binary Latent Variables.
In: Advances in Neural Information Processing Systems 19. MIT Press; 2007. pp. 1345–1352.
Sample data:
https://uoguelphca-my.sharepoint.com/:u:/g/personal/gwtaylor_uoguelph_ca/EfJARkZuiX1JmwMKQxQqKJMBaMBUNOcF83FW_n9gk7OIbg?e=fnCjet
@author Graham Taylor"""
import numpy