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
{
"0.png": true,
"1.png": false
}
@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
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;
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
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

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

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

#!/usr/bin/env python
import argparse
import json
import re
import subprocess
import sys
DEFAULT_FILE_PATTERN = r'.*\.[ch](pp)?'
import argparse
import collections
import datetime
import math
import numpy as np
import os
import sys
import tensorflow as tf
import time
import warnings