Skip to content

Instantly share code, notes, and snippets.

@botev
botev / test_lbfgs.py
Created September 21, 2017 02:42
Scipy LBFGS
import os
import time
import numpy as np
import theano
import theano.tensor as T
from scipy.optimize import fmin_l_bfgs_b
def scipy():
path = "."
@botev
botev / double_lop.py
Last active July 19, 2017 20:31
Double Lop
import time
import os
import numpy as np
import theano
import theano.tensor as T
from IPython.display import Image
def Rop(f, x, v):
if isinstance(f, (list, tuple)):
u = [T.zeros_like(fi) for fi in f]
@botev
botev / run_yellow_fin_vae.py
Last active July 13, 2017 13:42
Theano Yellow Fin
import numpy as np
import argparse
import theano
import theano.tensor as T
from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams
from theano.gradient import zero_grad
import lasagne.layers as L
@botev
botev / Theano_cuSOLVER.py
Last active March 23, 2017 13:43
Theano + cuSOLVER
from __future__ import absolute_import, print_function, division
import numpy as np
import theano
from theano import Op
import theano.tensor as T
from theano.gpuarray.basic_ops import (gpu_contiguous, as_gpuarray_variable,
infer_context_name)
from theano.gpuarray.type import get_context
@botev
botev / tensor_shapes.rs
Last active December 15, 2016 02:40
Demonstrating how we can use symbolic integer for automatic shape inference and verification.
use std::collections::HashMap;
extern crate symints;
use symints::*;
type SymInt = Polynomial<String, i64, u8>;
type Shape = (SymInt, SymInt, SymInt, SymInt);
enum ConvolutionMode {
@botev
botev / qtip
Created October 20, 2016 10:25
<!doctype html>
<html>
<head>
<title>MNIST</title>
<!-- jQuery -->
<script src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
<!-- Cytoscape -->
<script src="http://cytoscape.github.io/cytoscape.js/api/cytoscape.js-latest/cytoscape.min.js"></script>
<!-- Dagre -->
<script src="https://cdn.rawgit.com/cpettitt/dagre/v0.7.4/dist/dagre.min.js"></script>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
//
// Created by alex on 17/06/16.
//
#include "arrayfire.h"
#include "iomanip"
class BinaryCrossEntropy{
public:
inline
af::array func(af::array prediction, af::array targets){
@botev
botev / Iterator.cpp
Last active May 17, 2016 11:38
Iterator for arrayfire
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <iterator>
#include "arrayfire.h"
class AbstractDataSource{
protected:
unsigned instance_dim;
@botev
botev / test.cpp
Created April 27, 2016 21:09
Time my_reduce
//
// Created by alex on 26/04/16.
//
#include "arrayfire.h"
#include "myreduce.h"
#include "stdio.h"
#include "iostream"
static const int n = 100;
static const int M = 200;