b5a02391e003c33c8f8258a7e3d0736503c3c048,examples/babi_memnn.py,,,#,97

Before Change


match.add(Merge([input_encoder_m, question_encoder],
                mode="dot",
                dot_axes=[2, 2]))
match.add(Activation("softmax"))
// output: (samples, story_maxlen, query_maxlen)
// embed the input into a single vector with size = story_maxlen:
input_encoder_c = Sequential()
input_encoder_c.add(Embedding(input_dim=vocab_size,

After Change


print("Compiling...")

// placeholders
input_sequence = Input((story_maxlen,))
question = Input((query_maxlen,))

// encoders
// embed the input sequence into a sequence of vectors
input_encoder_m = Sequential()
input_encoder_m.add(Embedding(input_dim=vocab_size,
                              output_dim=64))
input_encoder_m.add(Dropout(0.3))
// output: (samples, story_maxlen, embedding_dim)

// embed the input into a sequence of vectors of size query_maxlen
input_encoder_c = Sequential()
input_encoder_c.add(Embedding(input_dim=vocab_size,
                              output_dim=query_maxlen))
input_encoder_c.add(Dropout(0.3))
// output: (samples, story_maxlen, query_maxlen)

// embed the question into a sequence of vectors
question_encoder = Sequential()
question_encoder.add(Embedding(input_dim=vocab_size,
                               output_dim=64,
                               input_length=query_maxlen))
question_encoder.add(Dropout(0.3))
// output: (samples, query_maxlen, embedding_dim)

// encode input sequence and questions (which are indices) to sequences of dense vectors
input_encoded_m = input_encoder_m(input_sequence)
input_encoded_c = input_encoder_c(input_sequence)
question_encoded = question_encoder(question)

// compute a "match" between the first input vector sequence
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: keras-team/keras
Commit Name: b5a02391e003c33c8f8258a7e3d0736503c3c048
Time: 2017-03-15
Author: farizrahman4u@gmail.com
File Name: examples/babi_memnn.py
Class Name:
Method Name:


Project Name: eriklindernoren/Keras-GAN
Commit Name: 4b71f9b988edf0d5c9e69078c40a1ff62a1853ef
Time: 2018-02-13
Author: eriklindernoren@live.se
File Name: ccgan/ccgan.py
Class Name: CCGAN
Method Name: build_discriminator


Project Name: onnx/onnxmltools
Commit Name: 80e1d0aba201d45ba32542327ab1a63e074a759e
Time: 2018-05-11
Author: wschin@outlook.com
File Name: tests/end2end/test_single_operator_with_cntk_backend.py
Class Name: TestKeras2CoreML2ONNX
Method Name: test_activation_2d