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 CoreML | |
import Combine | |
extension Publisher where Self.Output: MLFeatureProvider { | |
/** | |
Operator that lets you run a Core ML model as part of a Combine chain. | |
It accepts an MLFeatureProvider object as input, and, if all goes well, | |
returns another MLFeatureProvider with the model outputs. | |
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
# Convert SE-ResNet-50 from Caffe to Keras | |
# Using the model from https://github.com/shicai/SENet-Caffe | |
import os | |
import numpy as np | |
# The caffe module needs to be on the Python path; we'll add it here explicitly. | |
import sys | |
caffe_root = "/path/to/caffe" | |
sys.path.insert(0, caffe_root + "python") |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 | |
i = np.array(list(range(1, 50)), dtype=np.float).reshape((7, 7)) | |
k = np.array(list(range(1, 10)), dtype=np.float).reshape((3, 3)) | |
print("Input:"); print(i) | |
print("Kernel:"); print(k) | |
# Forward convolution. We need to pad the input so that we can read from | |
# its borders. (Not doing stride etc here.) |
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
/* | |
The "hello world" of neural networks: a simple 3-layer feed-forward | |
network that implements an XOR logic gate. | |
The first layer is the input layer. It has two neurons a and b, which | |
are the two inputs to the XOR gate. | |
The middle layer is the hidden layer. This has two neurons h1, h2 that | |
will learn what it means to be an XOR gate. | |
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 Cocoa | |
let input = "15,7, 3 ,, [1,2,[3, 4, 5], 6],8" | |
//let input = "5,7,[1]" | |
var index = input.characters.startIndex | |
var lookahead = input[index] | |
var done = false | |
func eat() { |
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
/* | |
Joseph Weizenbaum's classic ELIZA chat bot in Swift. | |
Based on the IBM PC BASIC program from CREATIVE COMPUTING by Patricia | |
Danielson and Paul Hashfield, and the Java adaptation by Jesper Juul. | |
Run this script from Terminal: | |
$ swift eliza.swift | |
Press Ctrl-C or Ctrl-D to quit. (Or type "shut up".) |
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
; ***************************************************************************** | |
; | |
; $VER: ZeroGravity Source 1.0 (C) 1997 Matthijs Hollemans | |
; | |
; ***************************************************************************** | |
; | |
; This is the full source code to Zero Gravity. I used the very cool ASM-One | |
; V1.29 assembler from T.F.A. but that doesn't matter anyway because you won't | |
; be able to reassemble this without the required binary includes... | |
; |