Skip to content

Instantly share code, notes, and snippets.

View rodoyle's full-sized avatar

Riley Doyle rodoyle

View GitHub Profile
def training_loop(n_epochs, model, optimiser, loss_fn,
train_input, train_target, test_input, test_target):
for i in range(n_epochs):
def closure():
optimiser.zero_grad()
out = model(train_input)
loss = loss_fn(out, train_target)
loss.backward()
return loss
optimiser.step(closure)
@rust-play
rust-play / playground.rs
Created July 20, 2018 17:02
Code shared from the Rust Playground
extern crate futures;
extern crate hyper;
extern crate tokio;
extern crate tokio_threadpool; // 0.1.4
#[macro_use]
extern crate serde_derive;
extern crate serde;
extern crate serde_json;
use futures::sync::oneshot;
@fduran
fduran / gist:1870502
Created February 20, 2012 18:26
Linux monitor & react to event in log file
# Linux. Act upon an event in a log file
# www.fduran.com
apt-get upgrade; apt-get install inotify-tools
# create file myalert.sh:
# example finding Exception in tomcat log and sending email
#!/bin/bash
while inotifywait -e modify /path/to/file.log; do