This file contains hidden or 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 math | |
import random | |
from functools import partial | |
N_NEURONS = 2 | |
N_ITERATIONS = 1000 | |
DOMAIN_FROM = -5 | |
DOMAIN_TO = 5 | |
class OutputNeuron(object): |
This file contains hidden or 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
// GRID DEFININTION | |
dg 1,1, INPUT_NODE_TYPE | |
mg Input | |
mg Bias | |
dg 1,2, STANDARD_NODE_TYPE | |
mg Output | |
dg 1,1, LINEAR_NODE_TYPE | |
mg Classification |
This file contains hidden or 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
<% if flash[:error] %> | |
<p class="welcome"><%= flash[:error] %></p> | |
<% end %> |
This file contains hidden or 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 math | |
import random | |
N_BIAS = 1 | |
def sigmoid(x): | |
return math.tanh(x) | |
def dsigmoid(y): | |
return 1.0 - y**2 |
This file contains hidden or 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 <stdio.h> | |
#include <stdlib.h> | |
#include <time.h> | |
#include <math.h> | |
/* | |
--------------------------------------------------------- | |
| P a r a l l e l N e u r a l N e t w o r k | | |
| u s i n g | | |
| S I G M O I D T R A N S F E R F U N C T I O N S | |
This file contains hidden or 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
//**************************************************************************// | |
// This is a modified version of the Microsoft sample code and loads a mesh.// | |
// it uses the helper class CDXUTSDKMesh, as there is no longer any built in// | |
// support for meshes in DirectX 11. // | |
// // | |
// The CDXUTSDKMesh is NOT DorectX, not is the file format it uses, the // | |
// .sdkmesh, a standard file format. You will hnot find the .sdkmesh format // | |
// outside the MS sample code. Both these things are provided as an entry // | |
// point only. // | |
// // |
This file contains hidden or 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 <stdio.h> | |
#include "zmq.h" | |
int main() { | |
void *context = zmq_ctx_new(); | |
void *in_sock = zmq_socket(context, ZMQ_SUB); | |
zmq_connect(in_sock, "tcp://127.0.0.1:8081"); | |
zmq_setsockopt(in_sock, ZMQ_SUBSCRIBE, "[TICKER]", 8 * sizeof(char)); | |
printf("Entering loop mode..\n"); | |
printf("Listening for [CHATTR] on tcp://127.0.0.1/8081\n"); |
This file contains hidden or 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 <stdio.h> | |
#include <stdlib.h> | |
#include <time.h> | |
#include <math.h> | |
typedef struct { | |
int n_inputs; | |
int n_hidden; | |
int n_outputs; |
This file contains hidden or 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
__global__ void calculateOutputForLayer(float *inputs, float *weight_matrix, int n_inputs, int n_outputs, float *output_matrix) { | |
output_matrix[n_outputs * threadIdx.y + threadIdx.x] = inputs[threadIdx.y] * weight_matrix[n_outputs * threadIdx.y + threadIdx.x]; | |
} | |
int main() { | |
// Build inputs and weights | |
int n_inputs = 4; | |
int n_outputs = 2; | |
float inputs[4] = {1,2,3,4}; |
This file contains hidden or 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
__global__ void doParallelReduction(float *d_matrix, int n_inputs, int n_outputs) { | |
float n = ceil(float(n_inputs) / 2f); // WRONG!!! | |
while(n > 1) { | |
if (threadIdx.y < n) { | |
int toSum = threadIdx.y + n; | |
if (toSum < ) | |
d_matrix[n_outputs * threadIdx.y + threadIdx.x] += d_matrix[n_outputs * (threadIdx.y + n) + threadIdx.x]; | |
} | |
__syncThreads(); |