5a6928a1c19fa0756cec6340224434c0a9f37367,opennmt/tests/transformer_test.py,TransformerTest,testSplitAndCombineHeads,#TransformerTest#,117
Before Change
num_heads = 8
depth = 20
inputs = tf.convert_to_tensor(
np.random.randn(batch_size, max(length), depth * num_heads).astype(np.float32))
split = transformer.split_heads(inputs, num_heads)
combined = transformer.combine_heads(split)
inputs, combined = self.evaluate([inputs, combined])
self.assertAllEqual(inputs, combined)
After Change
num_heads = 8
depth = 20
inputs = tf.random.normal([batch_size, max(length), depth * num_heads], dtype=tf.float32)
split = transformer.split_heads(inputs, num_heads)
combined = transformer.combine_heads(split)
inputs, combined = self.evaluate([inputs, combined])
self.assertAllEqual(inputs, combined)
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 11
Instances
Project Name: OpenNMT/OpenNMT-tf
Commit Name: 5a6928a1c19fa0756cec6340224434c0a9f37367
Time: 2019-04-01
Author: guillaume.klein@systrangroup.com
File Name: opennmt/tests/transformer_test.py
Class Name: TransformerTest
Method Name: testSplitAndCombineHeads
Project Name: OpenNMT/OpenNMT-tf
Commit Name: 5a6928a1c19fa0756cec6340224434c0a9f37367
Time: 2019-04-01
Author: guillaume.klein@systrangroup.com
File Name: opennmt/tests/transformer_test.py
Class Name: TransformerTest
Method Name: testCombineHeads
Project Name: OpenNMT/OpenNMT-tf
Commit Name: 5a6928a1c19fa0756cec6340224434c0a9f37367
Time: 2019-04-01
Author: guillaume.klein@systrangroup.com
File Name: opennmt/tests/transformer_test.py
Class Name: TransformerTest
Method Name: testSplitHeads