当前位置: 首页>>代码示例>>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;未经允许,请勿转载。