Python cntk.sigmoid() Examples
The following are 24
code examples of cntk.sigmoid().
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 File: autoencoders.py From CNTK-World with MIT License | 6 votes |
def create_model(features): ''' This function creates the architecture model. :param features: The input features. :return: The output of the network which its dimentionality is num_classes. ''' with C.layers.default_options(init = C.layers.glorot_uniform(), activation = C.ops.relu): # Hidden input dimention hidden_dim = 64 # Encoder encoder_out = C.layers.Dense(hidden_dim, activation=C.relu)(features) encoder_out = C.layers.Dense(int(hidden_dim / 2.0), activation=C.relu)(encoder_out) # Decoder decoder_out = C.layers.Dense(int(hidden_dim / 2.0), activation=C.relu)(encoder_out) decoder_out = C.layers.Dense(hidden_dim, activation=C.relu)(decoder_out) decoder_out = C.layers.Dense(feature_dim, activation=C.sigmoid)(decoder_out) return decoder_out # Initializing the model with normalized input.
Example #2
Source File: cntk_backend.py From DeepLearning_Wavelet-LSTM with MIT License | 5 votes |
def binary_crossentropy(target, output, from_logits=False): if from_logits: output = C.sigmoid(output) output = C.clip(output, epsilon(), 1.0 - epsilon()) output = -target * C.log(output) - (1.0 - target) * C.log(1.0 - output) return output
Example #3
Source File: cntk_backend.py From keras-lambda with MIT License | 5 votes |
def binary_crossentropy(output, target, from_logits=False): if from_logits: output = C.sigmoid(output) output = C.clip(output, _EPSILON, 1.0 - _EPSILON) output = -target * C.log(output) - (1.0 - target) * C.log(1.0 - output) return output
Example #4
Source File: cntk_backend.py From keras-lambda with MIT License | 5 votes |
def sigmoid(x): return C.sigmoid(x)
Example #5
Source File: conditional-DCGAN.py From CNTK-World with MIT License | 5 votes |
def D(x_img, x_code): ''' Detector network architecture Args: x_img: cntk.input_variable represent images to network x_code: cntk.input_variable represent conditional code to network ''' def bn_with_leaky_relu(x, leak=0.2): h = C.layers.BatchNormalization(map_rank=1)(x) r = C.param_relu(C.constant((np.ones(h.shape) * leak).astype(np.float32)), h) return r with C.layers.default_options(init=C.normal(scale=0.02)): h0 = C.layers.Convolution2D(dkernel, 1, strides=dstride)(x_img) h0 = bn_with_leaky_relu(h0, leak=0.2) print('h0 shape :', h0.shape) h1 = C.layers.Convolution2D(dkernel, 64, strides=dstride)(h0) h1 = bn_with_leaky_relu(h1, leak=0.2) print('h1 shape :', h1.shape) h2 = C.layers.Dense(256, activation=None)(h1) h2 = bn_with_leaky_relu(h2, leak=0.2) print('h2 shape :', h2.shape) h2_aug = C.splice(h2, x_code) h3 = C.layers.Dense(256, activation=C.relu)(h2_aug) h4 = C.layers.Dense(1, activation=C.sigmoid, name='D_out')(h3) print('h3 shape :', h4.shape) return h4
Example #6
Source File: cntk_backend.py From deepQuest with BSD 3-Clause "New" or "Revised" License | 5 votes |
def binary_crossentropy(target, output, from_logits=False): if from_logits: output = C.sigmoid(output) output = C.clip(output, epsilon(), 1.0 - epsilon()) output = -target * C.log(output) - (1.0 - target) * C.log(1.0 - output) return output
Example #7
Source File: cntk_backend.py From deepQuest with BSD 3-Clause "New" or "Revised" License | 5 votes |
def sigmoid(x): return C.sigmoid(x)
Example #8
Source File: cntk_backend.py From DeepLearning_Wavelet-LSTM with MIT License | 5 votes |
def binary_crossentropy(target, output, from_logits=False): if from_logits: output = C.sigmoid(output) output = C.clip(output, epsilon(), 1.0 - epsilon()) output = -target * C.log(output) - (1.0 - target) * C.log(1.0 - output) return output
Example #9
Source File: cntk_backend.py From DeepLearning_Wavelet-LSTM with MIT License | 5 votes |
def sigmoid(x): return C.sigmoid(x)
Example #10
Source File: cntk_backend.py From DeepLearning_Wavelet-LSTM with MIT License | 5 votes |
def binary_crossentropy(target, output, from_logits=False): if from_logits: output = C.sigmoid(output) output = C.clip(output, epsilon(), 1.0 - epsilon()) output = -target * C.log(output) - (1.0 - target) * C.log(1.0 - output) return output
Example #11
Source File: cntk_backend.py From DeepLearning_Wavelet-LSTM with MIT License | 5 votes |
def sigmoid(x): return C.sigmoid(x)
Example #12
Source File: cntk_backend.py From DeepLearning_Wavelet-LSTM with MIT License | 5 votes |
def sigmoid(x): return C.sigmoid(x)
Example #13
Source File: test_ops_unary.py From ngraph-python with Apache License 2.0 | 5 votes |
def test_sigmoid(): assert_cntk_ngraph_isclose(C.sigmoid([-2, -1., 0., 1., 2.])) assert_cntk_ngraph_isclose(C.sigmoid([0.])) assert_cntk_ngraph_isclose(C.exp([-0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0.]))
Example #14
Source File: cntk_backend.py From DeepLearning_Wavelet-LSTM with MIT License | 5 votes |
def sigmoid(x): return C.sigmoid(x)
Example #15
Source File: cntk_backend.py From DeepLearning_Wavelet-LSTM with MIT License | 5 votes |
def binary_crossentropy(target, output, from_logits=False): if from_logits: output = C.sigmoid(output) output = C.clip(output, epsilon(), 1.0 - epsilon()) output = -target * C.log(output) - (1.0 - target) * C.log(1.0 - output) return output
Example #16
Source File: cntk_backend.py From DeepLearning_Wavelet-LSTM with MIT License | 5 votes |
def sigmoid(x): return C.sigmoid(x)
Example #17
Source File: cntk_backend.py From DeepLearning_Wavelet-LSTM with MIT License | 5 votes |
def sigmoid(x): return C.sigmoid(x)
Example #18
Source File: cntk_backend.py From DeepLearning_Wavelet-LSTM with MIT License | 5 votes |
def binary_crossentropy(target, output, from_logits=False): if from_logits: output = C.sigmoid(output) output = C.clip(output, epsilon(), 1.0 - epsilon()) output = -target * C.log(output) - (1.0 - target) * C.log(1.0 - output) return output
Example #19
Source File: cntk_backend.py From DeepLearning_Wavelet-LSTM with MIT License | 5 votes |
def sigmoid(x): return C.sigmoid(x)
Example #20
Source File: cntk_backend.py From DeepLearning_Wavelet-LSTM with MIT License | 5 votes |
def binary_crossentropy(target, output, from_logits=False): if from_logits: output = C.sigmoid(output) output = C.clip(output, epsilon(), 1.0 - epsilon()) output = -target * C.log(output) - (1.0 - target) * C.log(1.0 - output) return output
Example #21
Source File: cntk_backend.py From DeepLearning_Wavelet-LSTM with MIT License | 5 votes |
def sigmoid(x): return C.sigmoid(x)
Example #22
Source File: train_end2end.py From end2end_AU_speech with MIT License | 5 votes |
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 #23
Source File: cntk_backend.py From GraphicDesignPatternByPython with MIT License | 5 votes |
def binary_crossentropy(target, output, from_logits=False): if from_logits: output = C.sigmoid(output) output = C.clip(output, epsilon(), 1.0 - epsilon()) output = -target * C.log(output) - (1.0 - target) * C.log(1.0 - output) return output
Example #24
Source File: cntk_backend.py From GraphicDesignPatternByPython with MIT License | 5 votes |
def sigmoid(x): return C.sigmoid(x)