Esempio n. 1
0
 def testConvEncoder(self):
     sequence_length = [17, 21, 20]
     inputs = tf.zeros([3, 21, 5])
     encoder = encoders.ConvEncoder(3, 3, 10)
     outputs, _, encoded_length = encoder(
         inputs, sequence_length=tf.constant(sequence_length))
     outputs, encoded_length = self.evaluate([outputs, encoded_length])
     self.assertAllEqual([3, 21, 10], outputs.shape)
     self.assertAllEqual(sequence_length, encoded_length)
Esempio n. 2
0
 def testConvEncoder(self):
     sequence_length = [17, 21, 20]
     inputs = _build_dummy_sequences(sequence_length)
     encoder = encoders.ConvEncoder(3, 10)
     outputs, _, encoded_length = encoder.encode(
         inputs, sequence_length=tf.constant(sequence_length))
     with self.test_session() as sess:
         sess.run(tf.global_variables_initializer())
         outputs, encoded_length = sess.run([outputs, encoded_length])
         self.assertAllEqual([3, 21, 10], outputs.shape)
         self.assertAllEqual(sequence_length, encoded_length)