Skip to content

Instantly share code, notes, and snippets.

import numpy as np
import numpy.linalg as la
class Kernel(object):
"""Implements list of kernels from
http://en.wikipedia.org/wiki/Support_vector_machine
"""
@staticmethod
def linear():
#! /usr/bin/env python
import pexpect
import pexpect.replwrap
repl = pexpect.replwrap.REPLWrapper("lua", u"> ", None, u"> ")
output = repl.run_command("= 1 + 1", timeout=1).splitlines()[1:]
assert(int(output[0]) == 2)
diff --git a/tutorials/optimize/opt_gemm.py b/tutorials/optimize/opt_gemm.py
index 44ee53a7..c9785cbf 100644
--- a/tutorials/optimize/opt_gemm.py
+++ b/tutorials/optimize/opt_gemm.py
@@ -44,24 +44,24 @@ import timeit
# The size of the matrix
# (M, K) x (K, N)
# You are free to try out different shapes, sometimes TVM optimization outperforms numpy with MKL.
-M = 1024
-K = 1024
@ajtulloch
ajtulloch / -
Created June 15, 2018 06:43
opt_gemm.diff
diff --git a/tutorials/optimize/opt_gemm.py b/tutorials/optimize/opt_gemm.py
index 44ee53a7..c9785cbf 100644
--- a/tutorials/optimize/opt_gemm.py
+++ b/tutorials/optimize/opt_gemm.py
@@ -44,24 +44,24 @@ import timeit
# The size of the matrix
# (M, K) x (K, N)
# You are free to try out different shapes, sometimes TVM optimization outperforms numpy with MKL.
-M = 1024
-K = 1024
@cython.boundscheck(False)
@cython.wraparound(False)
@cython.cdivision(True)
def _isotonic_regression(np.ndarray[DOUBLE, ndim=1] y,
np.ndarray[DOUBLE, ndim=1] weight,
np.ndarray[DOUBLE, ndim=1] solution):
cdef:
DOUBLE numerator, denominator
Py_ssize_t i, pooled, n, k
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
def _isotonic_regression(np.ndarray[DOUBLE, ndim=1] y,
np.ndarray[DOUBLE, ndim=1] weight,
np.ndarray[DOUBLE, ndim=1] solution):
cdef:
Py_ssize_t current, i
unsigned int len_active_set
DOUBLE v, w
len_active_set = y.shape[0]
#include <memory>
#include <random>
#include <chrono>
#include <algorithm>
#include <iostream>
#include <gflags/gflags.h>
#include <boost/chrono/chrono.hpp>
#include <boost/chrono/duration.hpp>
#include <boost/chrono/process_cpu_clocks.hpp>
#! /bin/bash
# A hacky script that converts org-mode documents to an old-style
# Remarkup dialect, used by Phabricator and other tools.
set -x
set -e
pandoc --read=org --write=markdown --atx-headers $1 \
| sed -E "s/\{\.(.*)\}/lang=\1/g" \
| sed -E "s/\[(.*)\]\((.*)\)/[[\2 | \1]]/g" \
--------------------8<--------------------
Final stats (running with 5 nodes for 30s):
Bytes read: 3.35MB
Bytes written: 3.30MB
Connection attempts: 806
Correct queries: 726
Score breakdown:
7260 points from queries
-1321 points from network traffic