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
(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
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
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
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}); | |
} |
NewerOlder