This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TEST(BasicTest, CommutativityTest) { | |
// declare property | |
auto func = [](int i, int j) { | |
return i + j == j + i; | |
}; | |
// test property | |
checkpp::check(checkpp::Property<int,int>{func}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
count = 10 | |
x = seq(from=1, to=count, by=1) | |
# calculating the mean is easy - just use the built-in mean function. | |
x_mean = mean(x) | |
# In this easy case, we can confirm that the mean is the same whether we use R or do the math by hand. | |
# We're using a summation formula to figure out the sum of the numbers from 1 to count. | |
x_sum_analytic = (count * (count + 1))/2 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
model = nn.Sequential() | |
model:add(nn.SpatialConvolution(1, 6, 5, 5)) | |
model:add(nn.SpatialMaxPooling(2,2,2,2)) | |
model:add(nn.SpatialConvolution(6, 16, 5,5)) | |
model:add(nn.SpatialMaxPooling(2,2,2,2)) | |
model:add(nn.View(16 * 5 * 5)) | |
model:add(nn.Linear(16 * 5 * 5, 256)) | |
model:add(nn.PReLU()) | |
model:add(nn.Dropout(0.5)) | |
model:add(nn.Linear(256, 10)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define (atom? x) | |
(and (not (pair? x)) | |
(not (null? x)))) | |
(define (assoc. x y) | |
(cond ((equal? (caar y) x) (cadar y)) | |
(#t (assoc. x (cdr y))))) | |
(define (eval. e a) | |
(cond |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; outlet code for implementing traditional macro expansion | |
;; macros | |
(define (expand form) | |
(cond | |
((variable? form) form) | |
((literal? form) form) | |
((macro? (car form)) | |
(expand ((macro-function (car form)) form))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import torch | |
import torch.nn as nn | |
from torch.autograd import Variable | |
import torch.nn.functional as F | |
import torch.optim as optim | |
class XorNet(nn.Module): | |
def __init__(self): | |
super().__init__() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required(VERSION 3.1) | |
project(dw_wrapper) | |
set (CMAKE_CXX_STANDARD 11) | |
# FindDriveworks.cmake, ArchConfiguration.cmake, and LibFindMacros.cmake were needed for my setup they are taken from driveworks/samples/cmake/ | |
# ArchConfiguration.cmake was the only file that needed small changes, remove the fatal error on line 17 and add the following lines in its place | |
# set(VIBRANTE TRUE) | |
# add_definitions(-DVIBRANTE) | |
# this is the path I placed the driveworks cmake files in |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket | |
(define (sum-to n term) | |
(letrec ((S (lambda (acc k) | |
(cond | |
[(eq? k 0) (+ (term 0) acc)] | |
[else (S (+ acc (term k)) (- k 1))])))) | |
(S 0.0 n))) | |
(define vs '()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "PicoSHA2/picosha2.h" | |
#include <iostream> | |
#include <string> | |
#include <vector> | |
#include <stdlib.h> | |
struct person { | |
std::string name; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% A Simple LaTeX Example | |
% Author: Richard C Kelley | |
% This is a comment. A comment begins with a '%' and extends to the | |
% end of the line. | |
% We always start our LaTeX documents by specifying the document class | |
% we want to use. There are several document classes available that | |
% you could use if you wanted - article, book, report, letter, | |
% etc. For many purposes, though, all you need is the article |
OlderNewer