'Must pad height and width in labels to match logits.
The tricky thing with 3-d is that the rows and columns need to remain
intact, so we\'ll test it with small known data.'

def testPadLabels3d(self):

    with self.test_session() as sess:
        ph_logits = tf.placeholder(tf.float32, shape=(None, None, None, 42))
        ph_labels = tf.placeholder(tf.int64, shape=(None, None, None))
        padded_labels = vgsl_model._PadLabels3d(ph_logits, ph_labels)
        real_logits = _rand(1, 3, 4, 42)
        real_labels = np.arange(6).reshape((1, 2, 3))
        np_array = sess.run([padded_labels], feed_dict={ph_logits: real_logits, ph_labels: real_labels})[0]
        self.assertEqual(tuple(np_array.shape), (1, 3, 4))
        self.assertAllEqual(np_array[0, :, :], [[0, 1, 2, 0], [3, 4, 5, 0], [0, 0, 0, 0]])
        real_labels = np.arange(8).reshape((1, 2, 4))
        np_array = sess.run([padded_labels], feed_dict={ph_logits: real_logits, ph_labels: real_labels})[0]
        self.assertEqual(tuple(np_array.shape), (1, 3, 4))
        self.assertAllEqual(np_array[0, :, :], [[0, 1, 2, 3], [4, 5, 6, 7], [0, 0, 0, 0]])
        real_labels = np.arange(10).reshape((1, 2, 5))
        np_array = sess.run([padded_labels], feed_dict={ph_logits: real_logits, ph_labels: real_labels})[0]
        self.assertEqual(tuple(np_array.shape), (1, 3, 4))
        self.assertAllEqual(np_array[0, :, :], [[0, 1, 2, 3], [5, 6, 7, 8], [0, 0, 0, 0]])
        real_labels = np.arange(9).reshape((1, 3, 3))
        np_array = sess.run([padded_labels], feed_dict={ph_logits: real_logits, ph_labels: real_labels})[0]
        self.assertEqual(tuple(np_array.shape), (1, 3, 4))
        self.assertAllEqual(np_array[0, :, :], [[0, 1, 2, 0], [3, 4, 5, 0], [6, 7, 8, 0]])
        real_labels = np.arange(12).reshape((1, 3, 4))
        np_array = sess.run([padded_labels], feed_dict={ph_logits: real_logits, ph_labels: real_labels})[0]
        self.assertEqual(tuple(np_array.shape), (1, 3, 4))
        self.assertAllEqual(np_array[0, :, :], [[0, 1, 2, 3], [4, 5, 6, 7], [8, 9, 10, 11]])
        real_labels = np.arange(15).reshape((1, 3, 5))
        np_array = sess.run([padded_labels], feed_dict={ph_logits: real_logits, ph_labels: real_labels})[0]
        self.assertEqual(tuple(np_array.shape), (1, 3, 4))
        self.assertAllEqual(np_array[0, :, :], [[0, 1, 2, 3], [5, 6, 7, 8], [10, 11, 12, 13]])
        real_labels = np.arange(12).reshape((1, 4, 3))
        np_array = sess.run([padded_labels], feed_dict={ph_logits: real_logits, ph_labels: real_labels})[0]
        self.assertEqual(tuple(np_array.shape), (1, 3, 4))
        self.assertAllEqual(np_array[0, :, :], [[0, 1, 2, 0], [3, 4, 5, 0], [6, 7, 8, 0]])
        real_labels = np.arange(16).reshape((1, 4, 4))
        np_array = sess.run([padded_labels], feed_dict={ph_logits: real_logits, ph_labels: real_labels})[0]
        self.assertEqual(tuple(np_array.shape), (1, 3, 4))
        self.assertAllEqual(np_array[0, :, :], [[0, 1, 2, 3], [4, 5, 6, 7], [8, 9, 10, 11]])
        real_labels = np.arange(20).reshape((1, 4, 5))
        np_array = sess.run([padded_labels], feed_dict={ph_logits: real_logits, ph_labels: real_labels})[0]
        self.assertEqual(tuple(np_array.shape), (1, 3, 4))
        self.assertAllEqual(np_array[0, :, :], [[0, 1, 2, 3], [5, 6, 7, 8], [10, 11, 12, 13]])
