def layer(x, w): b = np.array([1], dtype=theano.config.floatX) new_x = T.concatenate([x, b]) m = T.dot(w.T, new_x) h = nnet.sigmoid(m) return h