layers.py 文件源码

python
阅读 43 收藏 0 点赞 0 评论 0

项目:DeepRepICCV2015 作者: tomrunia 项目源码 文件源码
def __init__(self, input, n_in, n_out):

        # initialize with 0 the weights W as a matrix of shape (n_in, n_out)
        self.W = theano.shared(value=numpy.zeros((n_in, n_out),
                                                 dtype=theano.config.floatX),
                                name='W', borrow=True)
        # initialize the baises b as a vector of n_out 0s
        self.b = theano.shared(value=numpy.zeros((n_out,),
                                                 dtype=theano.config.floatX),
                               name='b', borrow=True)

        # compute vector of class-membership probabilities in symbolic form
        self.p_y_given_x = T.nnet.softmax(T.dot(input, self.W) + self.b)

        self.p_y_given_x_printed = theano.printing.Print('p_y_given_x = ')(self.p_y_given_x)
        #self.p_y_given_x_printed = self.p_y_given_x

        # compute prediction as class whose probability is maximal in
        # symbolic form
        self.y_pred = T.argmax(self.p_y_given_x, axis=1)  
       # parameters of the model
        self.params = [self.W, self.b]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号