当前位置: 首页>>代码示例>>Python>>正文


Python cntk.parameter方法代码示例

本文整理汇总了Python中cntk.parameter方法的典型用法代码示例。如果您正苦于以下问题:Python cntk.parameter方法的具体用法?Python cntk.parameter怎么用?Python cntk.parameter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cntk的用法示例。


在下文中一共展示了cntk.parameter方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: random_uniform_variable

# 需要导入模块: import cntk [as 别名]
# 或者: from cntk import parameter [as 别名]
def random_uniform_variable(shape, low, high,
                            dtype=None, name=None, seed=None):
    if dtype is None:
        dtype = floatx()
    if seed is None:
        # ensure that randomness is conditioned by the Numpy RNG
        seed = np.random.randint(10e3)

    if dtype is None:
        dtype = np.float32
    else:
        dtype = _convert_string_dtype(dtype)

    if name is None:
        name = ''

    scale = (high - low) / 2
    p = C.parameter(
        shape,
        init=C.initializer.uniform(
            scale,
            seed=seed),
        dtype=dtype,
        name=name)
    return variable(value=p.value + low + scale) 
开发者ID:Relph1119,项目名称:GraphicDesignPatternByPython,代码行数:27,代码来源:cntk_backend.py

示例2: random_uniform_variable

# 需要导入模块: import cntk [as 别名]
# 或者: from cntk import parameter [as 别名]
def random_uniform_variable(shape, low, high, dtype=_FLOATX,
                            name=None, seed=None):
    if seed is None:
        # ensure that randomness is conditioned by the Numpy RNG
        seed = np.random.randint(10e3)

    if dtype is None:
        dtype = np.float32
    else:
        dtype = _convert_string_dtype(dtype)

    if name is None:
        name = ''

    scale = (high - low) / 2
    p = C.parameter(
        shape,
        init=C.initializer.uniform(
            scale,
            seed=seed),
        dtype=dtype,
        name=name)
    return variable(value=p.value + low + scale) 
开发者ID:sunilmallya,项目名称:keras-lambda,代码行数:25,代码来源:cntk_backend.py

示例3: random_normal_variable

# 需要导入模块: import cntk [as 别名]
# 或者: from cntk import parameter [as 别名]
def random_normal_variable(
        shape,
        mean,
        scale,
        dtype=_FLOATX,
        name=None,
        seed=None):
    if seed is None:
        # ensure that randomness is conditioned by the Numpy RNG
        seed = np.random.randint(10e7)
    if dtype is None:
        dtype = np.float32
    else:
        dtype = _convert_string_dtype(dtype)

    if name is None:
        name = ''

    return C.parameter(
        shape=shape,
        init=C.initializer.normal(
            scale=scale,
            seed=seed),
        dtype=dtype,
        name=name) 
开发者ID:sunilmallya,项目名称:keras-lambda,代码行数:27,代码来源:cntk_backend.py

示例4: linear_layer

# 需要导入模块: import cntk [as 别名]
# 或者: from cntk import parameter [as 别名]
def linear_layer(input_var, output_dim):
    input_dim = input_var.shape[0]

    weight = C.parameter(shape=(input_dim, output_dim))
    bias = C.parameter(shape=(output_dim))

    return bias + C.times(input_var, weight) 
开发者ID:NervanaSystems,项目名称:ngraph-python,代码行数:9,代码来源:feed_forward.py

示例5: linear_layer

# 需要导入模块: import cntk [as 别名]
# 或者: from cntk import parameter [as 别名]
def linear_layer(input_var, output_dim):
    input_dim = input_var.shape[0]

    weight_param = C.parameter(shape=(input_dim, output_dim))
    bias_param = C.parameter(shape=(output_dim))

    return C.times(input_var, weight_param) + bias_param 
开发者ID:NervanaSystems,项目名称:ngraph-python,代码行数:9,代码来源:logistic_regression.py

示例6: random_normal_variable

# 需要导入模块: import cntk [as 别名]
# 或者: from cntk import parameter [as 别名]
def random_normal_variable(
        shape,
        mean,
        scale,
        dtype=None,
        name=None,
        seed=None):
    if dtype is None:
        dtype = floatx()
    if seed is None:
        # ensure that randomness is conditioned by the Numpy RNG
        seed = np.random.randint(10e7)
    if dtype is None:
        dtype = np.float32
    else:
        dtype = _convert_string_dtype(dtype)

    if name is None:
        name = ''

    p = C.parameter(
        shape=shape,
        init=C.initializer.normal(
            scale=scale,
            seed=seed),
        dtype=dtype,
        name=name)
    return variable(value=p.value + mean) 
开发者ID:Relph1119,项目名称:GraphicDesignPatternByPython,代码行数:30,代码来源:cntk_backend.py

示例7: truncated_normal

# 需要导入模块: import cntk [as 别名]
# 或者: from cntk import parameter [as 别名]
def truncated_normal(shape, mean=0.0, stddev=1.0, dtype=None, seed=None):
    if seed is None:
        seed = np.random.randint(1, 10e6)
    if dtype is None:
        dtype = np.float32
    else:
        dtype = _convert_string_dtype(dtype)

    return C.parameter(
        shape, init=C.initializer.truncated_normal(
            stddev, seed=seed), dtype=dtype) 
开发者ID:Relph1119,项目名称:GraphicDesignPatternByPython,代码行数:13,代码来源:cntk_backend.py

示例8: conv_from_weights

# 需要导入模块: import cntk [as 别名]
# 或者: from cntk import parameter [as 别名]
def conv_from_weights(x, weights, bias=None, padding=True, name=""):
    """ weights is a numpy array """
    k = C.parameter(shape=weights.shape, init=weights)
    y = C.convolution(k, x, auto_padding=[False, padding, padding])
    if bias:
        b = C.parameter(shape=bias.shape, init=bias)
        y = y + bias
    y = C.alias(y, name=name)
    return y


# bi-directional recurrence function op
# fwd, bwd: a recurrent op, LSTM or GRU 
开发者ID:haixpham,项目名称:end2end_AU_speech,代码行数:15,代码来源:LayerUtils.py

示例9: random_normal_variable

# 需要导入模块: import cntk [as 别名]
# 或者: from cntk import parameter [as 别名]
def random_normal_variable(
        shape,
        mean,
        scale,
        dtype=None,
        name=None,
        seed=None):
    if dtype is None:
        dtype = floatx()
    if seed is None:
        # ensure that randomness is conditioned by the Numpy RNG
        seed = np.random.randint(10e7)
    if dtype is None:
        dtype = np.float32
    else:
        dtype = _convert_string_dtype(dtype)

    if name is None:
        name = ''

    return C.parameter(
        shape=shape,
        init=C.initializer.normal(
            scale=scale,
            seed=seed),
        dtype=dtype,
        name=name) 
开发者ID:hello-sea,项目名称:DeepLearning_Wavelet-LSTM,代码行数:29,代码来源:cntk_backend.py


注:本文中的cntk.parameter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。