/* fully connected (inner product) layer

	sgemm
 */
var weblas = require('weblas');

function Neuron(weights, bias, dropout){

	// transpose weights are required
	this.weights = new weblas.pipeline.Tensor([K, N], weights);
	this.bias = new weblas.pipeline.Tensor([1, N], bias);
	this.dropout = dropout;
}

Neuron.prototype.forward = function(input){

	var inputT;
	// fix input?
	if(typeof input === "Tensor"){
		inputT = input;
	} else {
		inputT = new weblas.pipeline.Tensor([]);
	}

	var output = weblas.pipeline.sgemm(this.droput, inputT, this.weights, this.dropout, this.bias);

	return output;
};

@@ -121,16 +121,193 @@
 pout)%7B%0A%0A
+%09var N = bias.length;%0A%09var K = (weights.length / N) %7C 0;%0A%0A%09if(K * N !== weights.length)%0A%09%09throw new Error(%22Weights array must have length which is a multiple of bias array.%22);%0A%0A
 %09// tran
@@ -381,12 +381,12 @@
 or(%5B
-K, N
+N, K
 %5D, w
@@ -477,16 +477,42 @@
 out;%0A%7D%0A%0A
+module.exports = Neuron;%0A%0A
 Neuron.p
@@ -636,16 +636,49 @@
  else %7B%0A
+%09%09var K = this.weights.shape%5B1%5D;%0A
 %09%09inputT
@@ -708,17 +708,28 @@
 Tensor(%5B
-%5D
+1, K%5D, input
 );%0A%09%7D%0A%0A%09
@@ -772,16 +772,17 @@
 his.drop
+o
 ut, inpu
@@ -803,33 +803,79 @@
 ts, 
-this.dropout, this.bias);
+1.0, this.bias);%0A%0A%09if(typeof input !== %22Tensor%22)%7B%0A%09%09inputT.delete();%0A%09%7D
 %0A%0A%09r

first passing test: neuron