Python cntk.tanh() Examples

The following are 12 code examples of cntk.tanh(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module cntk , or try the search function .
Example #1
Source Project: ngraph-python   Author: NervanaSystems   File: test_ops_unary.py    License: Apache License 2.0 5 votes vote down vote up
def test_tanh():
    assert_cntk_ngraph_isclose(C.tanh([-2, -1., 0., 1., 2.]))
    assert_cntk_ngraph_isclose(C.tanh([0.]))
    assert_cntk_ngraph_isclose(C.tanh([-0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0.])) 
Example #2
Source Project: GraphicDesignPatternByPython   Author: Relph1119   File: cntk_backend.py    License: MIT License 5 votes vote down vote up
def tanh(x):
    return C.tanh(x) 
Example #3
Source Project: end2end_AU_speech   Author: haixpham   File: train_end2end.py    License: MIT License 5 votes vote down vote up
def create_model(input, net_type="gru", encoder_type=1, model_file=None, e3cloning=False):
    if encoder_type == 1:
        h = audio_encoder(input)
        if net_type.lower() is not "cnn":
            h = flatten(h)
    elif encoder_type == 2:
        h = audio_encoder_2(input)
        # pooling
        h = C.layers.GlobalAveragePooling(name="avgpool")(h)
        h = C.squeeze(h)
    elif encoder_type == 3:
        h = audio_encoder_3(input, model_file, e3cloning)
        if net_type.lower() is not "cnn":
            h = flatten(h)
    else:
        raise ValueError("encoder type {:d} not supported".format(encoder_type))

    if net_type.lower() == "cnn":
        h = C.layers.Dense(1024, init=C.he_normal(), activation=C.tanh)(h)
    elif net_type.lower() == "gru":
        h = C.layers.Recurrence(step_function=C.layers.GRU(256), go_backwards=False, name="rnn")(h)
    elif net_type.lower() == "lstm":
        h = C.layers.Recurrence(step_function=C.layers.LSTM(256), go_backwards=False, name="rnn")(h)
    elif net_type.lower() == "bigru":
        # bi-directional GRU
        h = bi_recurrence(h, C.layers.GRU(128), C.layers.GRU(128), name="bigru")
    elif net_type.lower() == "bilstm":
        # bi-directional LSTM
        h = bi_recurrence(h, C.layers.LSTM(128), C.layers.LSTM(128), name="bilstm")
    h = C.layers.Dropout(0.2)(h)
    # output
    y = C.layers.Dense(label_dim, activation=C.sigmoid, init=C.he_normal(), name="output")(h)
    return y

#--------------------------------------
# loss functions
#-------------------------------------- 
Example #4
Source Project: DeepLearning_Wavelet-LSTM   Author: hello-sea   File: cntk_backend.py    License: MIT License 5 votes vote down vote up
def tanh(x):
    return C.tanh(x) 
Example #5
Source Project: DeepLearning_Wavelet-LSTM   Author: hello-sea   File: cntk_backend.py    License: MIT License 5 votes vote down vote up
def tanh(x):
    return C.tanh(x) 
Example #6
Source Project: DeepLearning_Wavelet-LSTM   Author: hello-sea   File: cntk_backend.py    License: MIT License 5 votes vote down vote up
def tanh(x):
    return C.tanh(x) 
Example #7
Source Project: DeepLearning_Wavelet-LSTM   Author: hello-sea   File: cntk_backend.py    License: MIT License 5 votes vote down vote up
def tanh(x):
    return C.tanh(x) 
Example #8
Source Project: DeepLearning_Wavelet-LSTM   Author: hello-sea   File: cntk_backend.py    License: MIT License 5 votes vote down vote up
def tanh(x):
    return C.tanh(x) 
Example #9
Source Project: DeepLearning_Wavelet-LSTM   Author: hello-sea   File: cntk_backend.py    License: MIT License 5 votes vote down vote up
def tanh(x):
    return C.tanh(x) 
Example #10
Source Project: DeepLearning_Wavelet-LSTM   Author: hello-sea   File: cntk_backend.py    License: MIT License 5 votes vote down vote up
def tanh(x):
    return C.tanh(x) 
Example #11
Source Project: deepQuest   Author: sheffieldnlp   File: cntk_backend.py    License: BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def tanh(x):
    return C.tanh(x) 
Example #12
Source Project: keras-lambda   Author: sunilmallya   File: cntk_backend.py    License: MIT License 5 votes vote down vote up
def tanh(x):
    return C.tanh(x)