當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。