Skip to content

Instantly share code, notes, and snippets.

View calclavia's full-sized avatar

Henry Mao calclavia

View GitHub Profile
@calclavia
calclavia / sru.py
Created July 22, 2018 06:31
Pure Pytorch Implementation of SRU
import torch.nn as nn
class SRU(nn.Module):
""" Simple Recurrent Unit https://arxiv.org/pdf/1709.02755.pdf """
def __init__(self, input_size, hidden_size, activation=F.tanh):
super().__init__()
self.input_size = input_size
self.hidden_size = hidden_size
@calclavia
calclavia / keras_pg.py
Created June 6, 2017 18:48
Monte Carlo Policy Gradient in Keras
import gym
import numpy as np
from keras.models import Model
from keras.layers import *
from keras import backend as K
from collections import deque
def one_hot(index, categories):
@calclavia
calclavia / gist:60b30c497adce5587f70
Last active March 16, 2022 18:35 — forked from RX14/gist:6e04cd9fc71c52191def
Create property file with Gradle
def propertyFile = file "src/main/resources/META-INF/some.properties"
def props = new Properties()
propertyFile.withReader { props.load(it) }
props.setProperty("version", project.version)
propertyFile.withWriter { props.store(it) }
### Keybase proof
I hereby claim:
* I am calclavia on github.
* I am calclavia (https://keybase.io/calclavia) on keybase.
* I have a public key whose fingerprint is 286A B9D4 640F 586E 1D45 55C9 4ED2 7348 F4C4 0B9C
To claim this, I am signing this object:
/**
* Generates a TeamCity XML changelog via the REST API.
*/
task("createChangelog").doLast {
def teamCityURL = "http://ci.calclavia.com/"
/**
* Create a new file
*/