當前位置: 首頁>>代碼示例>>Python>>正文


Python tensor.true_div方法代碼示例

本文整理匯總了Python中theano.tensor.true_div方法的典型用法代碼示例。如果您正苦於以下問題:Python tensor.true_div方法的具體用法?Python tensor.true_div怎麽用?Python tensor.true_div使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在theano.tensor的用法示例。


在下文中一共展示了tensor.true_div方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: fit

# 需要導入模塊: from theano import tensor [as 別名]
# 或者: from theano.tensor import true_div [as 別名]
def fit(self, weights, o_error, tpo ):

        gradients = T.grad(o_error ,weights)
        updates = []
        for c, v, w, g in zip(self.t_cache, self.t_velocity, weights,gradients):
            new_velocity = T.sub( T.mul(tpo["momentum_rate"], v) , T.mul(tpo["learn_rate"], g) )
            new_cache = T.add( T.mul(tpo["decay_rate"] , c) , T.mul(T.sub( 1, tpo["decay_rate"]) , T.sqr(g)))
            new_weights = T.sub(T.add(w , new_velocity) , T.true_div( T.mul(g,tpo["learn_rate"]) , T.sqrt(T.add(new_cache,0.1**8))))
            updates.append((w, new_weights))
            updates.append((v, new_velocity))
            updates.append((c, new_cache))

        return updates


######                 Nesterov momentum
######################################## 
開發者ID:JoergFranke,項目名稱:recnet,代碼行數:19,代碼來源:update_function.py

示例2: avg_pool

# 需要導入模塊: from theano import tensor [as 別名]
# 或者: from theano.tensor import true_div [as 別名]
def avg_pool(input_layer, **kwargs):
    # hack to work around https://github.com/Theano/Theano/issues/3776
    norm = nn.layers.ExpressionLayer(input_layer, lambda X: T.ones_like(X))
    norm = nn.layers.Pool2DLayer(norm, mode='average_inc_pad', **kwargs)
    l = nn.layers.Pool2DLayer(input_layer, mode='average_inc_pad', **kwargs)
    l = nn.layers.ElemwiseMergeLayer([l, norm], T.true_div)
    return l 
開發者ID:felixlaumon,項目名稱:kaggle-right-whale,代碼行數:9,代碼來源:inception.py

示例3: SlopeLin

# 需要導入模塊: from theano import tensor [as 別名]
# 或者: from theano.tensor import true_div [as 別名]
def SlopeLin(slope):
    """
    Linear unit with different slopes
    :param slope: slope of negative quadrant
    :return: x if x > 0 else x/slope
    """
    import theano.tensor as T

    def inner(x):
        return T.switch(T.gt(x, 0), x, T.true_div(x, slope))
    return inner 
開發者ID:moberweger,項目名稱:deep-prior,代碼行數:13,代碼來源:helpers.py

示例4: SlopeLin2

# 需要導入模塊: from theano import tensor [as 別名]
# 或者: from theano.tensor import true_div [as 別名]
def SlopeLin2(x, slope):
    """
    Linear unit with different slopes
    :param slope: slope of negative quadrant
    :return: x if x > 0 else x/slope
    """

    import theano.tensor as T
    return T.switch(T.gt(x, 0), x, T.true_div(x, slope)) 
開發者ID:moberweger,項目名稱:deep-prior,代碼行數:11,代碼來源:helpers.py

示例5: get_output_for

# 需要導入模塊: from theano import tensor [as 別名]
# 或者: from theano.tensor import true_div [as 別名]
def get_output_for(self, inputs, deterministic=False, **kwargs):
        alpha,beta = inputs
        # return 2*T.true_div(alpha,T.add(alpha,beta)+1e-8)-1
        return 2*(alpha/(alpha+beta+1e-8))-1

# Convenience Function to produce a residual pre-activation MDCL block 
開發者ID:ajbrock,項目名稱:Neural-Photo-Editor,代碼行數:8,代碼來源:layers.py


注:本文中的theano.tensor.true_div方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。