Skip to content

Instantly share code, notes, and snippets.

View goldsborough's full-sized avatar
🔨
Fixing things

Peter Goldsborough goldsborough

🔨
Fixing things
View GitHub Profile
#!/usr/bin/env python
import argparse
import json
import re
import subprocess
import sys
DEFAULT_FILE_PATTERN = r'.*\.[ch](pp)?'
layout title summary date categories
post
A Promenade of PyTorch
A brief overview of the most popular dynamic-graph deep learning framework
2018-02-04 20-17-20
ml ai python

For the past two years, I've been quite heavily invested in TensorFlow, either writing papers about it, giving

PyTorch

PyTorch is, at its core, a Python library enabling GPU-accelerated tensor computation, similar to NumPy. On top of this, PyTorch provides a rich API for neural network and other machine learning workloads.

PyTorch differentiates itself from other machine learning frameworks in that it does not use static computational graphs -- defined once, ahead of time -- like TensorFlow. Instead, PyTorch computation graphs are dynamic and defined by run. This means that each invocation of a machine learning model's layers define a new computation graph, on the fly. The creation of this graph is implicit, in the sense that the library takes care of recording the flow of data

from __future__ import print_function
from __future__ import division
import argparse
import matplotlib.pyplot as plot
import numpy as np
import torch.utils.data
import torchvision.datasets
from torch import nn, optim
from __future__ import print_function
from __future__ import division
import argparse
import matplotlib.pyplot as plot
import numpy as np
import torch.utils.data
import torchvision.datasets
from torch import nn, optim
import argparse
import numpy as np
import torch.utils.data
import torchvision.datasets
from torch import nn, optim
from torch.autograd import Variable
from torchvision import transforms
const float two_pi = 2.0f * 3.14159265358979323846f;
for (int i = 0; i < kNumber; i += 16) {
for (int j = 0; j < 8; ++j) {
const float u1 = 1 - uniform[i + j];
const float u2 = uniform[i + 8 + j];
const float radius = std::sqrt(-2 * std::log(u1));
const float theta = two_pi * u2;
@goldsborough
goldsborough / calculate.ml
Created November 26, 2017 11:56
Arithmetic Expression Evaluator in OCaml
open Printf
type token =
| Digit of int
| Operator of char
| LeftParen
| RightParen
;;
let token_to_string = function
{
"0.png": true,
"1.png": false
}
# Your keymap
#
# Atom keymaps work similarly to style sheets. Just as style sheets use
# selectors to apply styles to elements, Atom keymaps use selectors to associate
# keystrokes with events in specific contexts. Unlike style sheets however,
# each selector can only be declared once.
#
# You can create a new keybinding in this file by typing "key" and then hitting
# tab.
#